<template>
  <div class="merchandise-management-add views-container">
    <!-- <div class="wlm-table no-bg">
      <div class="wlm-table-content">
        <div class="wlm-form-steps flex-row flex-align-c flex-justify-c">
          <div class="goods-step">
            <span @click="nextStep" :class="{'active':formFormatData.formStep === 1}">编辑基础信息</span>
            <span @click="nextStep" :class="{'active':formFormatData.formStep === 2}">编辑商品详情</span>
          </div>
        </div>
      </div>
    </div> -->
    <channel-source-loding
          :progressNum="progressNum"
          :isLoading="syncMaterialLoding"
        ></channel-source-loding>
    <div class="wlm-form">
      <div class="wlm-form-header">
        选择商品类型
        <span class="form-help" style="margin-left:10px;">保存后不可再次编辑，请慎重操作</span>
      </div>
      <div class="send-type">
        <el-button :disabled="isFormEdit || type"  @click="chanageShopType(10)" plain :class="[`send-item ${formFormatData.formData.transport_type == 10?'is-active':''}`]">
          <p>核销商品</p>
          <span>(无需物流)</span>
          <p class="triangle">
            <i class="el-icon-check"></i>
          </p>
        </el-button>
        <el-button
          :disabled="isFormEdit || type"
          @click="chanageShopType(20)"
          plain
        :class="[`send-item ${formFormatData.formData.transport_type == 20?'is-active':''}`]">
          <p>实物商品</p>
          <span>(物流发货)</span>
          <p class="triangle">
            <i class="el-icon-check"></i>
          </p>
        </el-button>
        <el-button
          v-if="patSetting.plugin.kammi.open"
          :disabled="isFormEdit || type"
          @click="chanageShopType(30)"
          plain
         :class="[`send-item ${formFormatData.formData.transport_type == 30?'is-active':''}`]">
          <p>卡密商品</p>
          <span>(无需物流)</span>
          <p class="triangle">
            <i class="el-icon-check"></i>
          </p>
        </el-button>
        <el-button
          :disabled="isFormEdit"
          v-if="patSetting.plugin.cgp.open"
          @click="chanageShopType(40)"
          plain
        :class="[`send-item ${formFormatData.formData.transport_type == 40?'is-active':''}`]">
          <p>团购商品</p>
          <span>上门自提</span>
          <p class="triangle">
            <i class="el-icon-check"></i>
          </p>
        </el-button>
        <el-button
          :disabled="isFormEdit|| type"
          v-if="patSetting.plugin.gift.open"
          @click="chanageShopType(50)"
          plain
          :class="[`send-item ${formFormatData.formData.transport_type == 50?'is-active':''}`]">
          <p>礼包商品</p>
          <span>(无需物流)</span>
          <p class="triangle">
            <i class="el-icon-check"></i>
          </p>
        </el-button>
         <el-button
          :disabled="isFormEdit|| type"
          v-if="patSetting.plugin.ticketing.open"
          @click="chanageShopType(60)"
          plain
          :class="[`send-item ${formFormatData.formData.transport_type == 60?'is-active':''}`]">
          <p>票务商品</p>
          <span>票务商品</span>
          <p class="triangle">
            <i class="el-icon-check"></i>
          </p>
        </el-button>
      </div>
    </div>
     <div class="wlm-form">
         <el-form ref="smsSettings" :model="formFormatData.formData" :rules="formFormatData.rules" size="small"  label-width="145px" class="retail-form" label-position="right">
            <el-form-item label="票务平台" v-if="formFormatData.formData.transport_type == 60">
                      <el-radio-group v-model="formFormatData.formData.ticketType" @change="ticketbtn">
                        <el-radio :label="1">自我游</el-radio>
                        <el-radio :label="2">天时同城</el-radio>
                        <el-radio :label="3">银科环企</el-radio>
                        <el-radio :label="4">票付通</el-radio>
                      </el-radio-group>
            </el-form-item>
             <el-form-item label="票务种类" v-if="formFormatData.formData.transport_type == 60 &&formFormatData.formData.spec_type!=20">
                      <el-select v-model="formFormatData.formData.sku[0]['goodsid_fk']" class="mincheck" placeholder="请选择" @change="goodsfk">
                                    <el-option v-for="item in categoryidData" :key="item.id" :label="`${item.goods_name}——${item.info_id}`" :value="item.id">
                                    </el-option>
                                </el-select>
                                  <!-- <div class="form-help" style="margin-top:4px;">
                                    <router-link target="_blank" to="/application/ticketingmer">
                                      <el-button type="text" class="text-primary">添加</el-button>
                                    </router-link>|
                                    <el-button type="text" @click="categoDataGet">刷新</el-button>
                                  </div> -->
            </el-form-item>
         </el-form>
      <el-tabs v-model="activeName" type="card" >
        <el-tab-pane label="基础设置" name="first">
              <section>
                  <div class="wlm-form-content">
                    <el-form ref="smsSettings" :model="formFormatData.formData" :rules="formFormatData.rules" size="small"  label-width="145px" class="retail-form" label-position="right">
                      <el-form-item label="商品名称" prop="goods_name" >
                        <!-- <el-input type="textarea"  :autosize="{ minRows: 1, maxRows: 4}" v-model="formFormatData.formData.goods_name" style="width:55%;" :maxlength="100"></el-input>
                        <p class="form-help">名称不能超过100个字符</p> -->
                        <el-input type="textarea"  :autosize="{ minRows: 1, maxRows: 4}" v-model="formFormatData.formData.goods_name" style="width:80%;" ></el-input>
                      </el-form-item>
                     <el-form-item label="渠道" prop="source">
                        <el-checkbox-group v-model="formFormatData.formData.source" >
                          <el-checkbox label="2" v-if="JSON.stringify($store.getters.power).indexOf('wxapp')>-1">微信小程序</el-checkbox>
                              <el-checkbox label="3" v-if="JSON.stringify($store.getters.power).indexOf('H5')>-1">H5</el-checkbox>
                              <el-checkbox label="4" v-if="JSON.stringify($store.getters.power).indexOf('wechat')>-1">微信公众号</el-checkbox>
                              <el-checkbox label="7" v-if="JSON.stringify($store.getters.power).indexOf('aliapp')>-1">支付宝小程序</el-checkbox>
                              <el-checkbox label="9" v-if="JSON.stringify($store.getters.power).indexOf('toutiaoapp')>-1">抖音-头条</el-checkbox>
                          <!-- <el-checkbox label="2" v-if="$store.getters.power.includes('wxapp')">微信小程序</el-checkbox>
                          <el-checkbox label="3" v-if="$store.getters.power.includes('H5')">H5</el-checkbox>
                          <el-checkbox label="4" v-if="$store.getters.power.includes('wechat')">微信公众号</el-checkbox>
                          <el-checkbox label="7" v-if="$store.getters.power.includes('aliapp')">支付宝小程序</el-checkbox>
                          <el-checkbox label="9" v-if="$store.getters.power.includes('toutiaoapp')">抖音-头条</el-checkbox> -->
                        </el-checkbox-group>
                      </el-form-item>
                        <el-form-item label="公众号回复关键字"  >
                        <!-- <el-input type="textarea"  :autosize="{ minRows: 1, maxRows: 4}" v-model="formFormatData.formData.goods_name" style="width:55%;" :maxlength="100"></el-input>
                        <p class="form-help">名称不能超过100个字符</p> -->
                        <el-input v-model="formFormatData.formData.weixin_reply_content" style="width:80%;" :maxlength="15"></el-input>
                      </el-form-item>
                      <el-form-item label="商品分类" prop="category_id">
                        <el-select v-model="category_name" multiple @remove-tag="removeTag" collapse-tags placeholder="请选择">
                          <el-option style="height:auto;padding: 0;" key="key" label="label" value="value" v-if="categoryData.length>0">
                            <div class="category-tree">
                              <el-tree
                                  ref="trees"
                                  @check="checkChange"
                                  :default-checked-keys="formFormatData.formData.category_id"
                                  node-key="category_id"
                                  highlight-current
                                  :props="{label: 'name',children: 'child',isLeaf: 'leaf'}"
                                  :data="categoryData"
                                  show-checkbox></el-tree>
                            </div>
                          </el-option>
                        </el-select>
                        <div class="form-help">
                          <router-link target="_blank" :to="{path:'/merchandise/merchandiseCategories',query:{  store_user_id:$route.query.store_user_id?$route.query.store_user_id:'',
                  h_aid:$route.query.h_aid?$route.query.h_aid:'',}}">
                            <el-button type="text" class="text-primary">创建分类</el-button>
                          </router-link>|
                          <el-button type="text" @click="categoryGet">刷新</el-button>
                        </div>
                      </el-form-item>
                      <el-form-item label="商品图" prop="goodsImages">
                        <!-- <upload ref="uploadplatform" :config="platformConfig" :changeEvt="formFormatFiltersChange"></upload> -->
                        <!-- {{formFormatData.formData.image}} -->
                        <choose-files ref="chooseFiles" :config="choosePlatformConfig" :changeEvt="formFormatFiltersChange"></choose-files>
                        <div class="form-help">建议尺寸：750*750像素，第一张为商品主图，其他为商品轮播图，可以拖拽图片调整顺序，商品海报选取轮播图第一张</div>
                      </el-form-item>
                      <el-form-item label="商品正方形主图">
                        <choose-files ref="chooseFiles" :config="chooseBgConfig" :changeEvt="formFormatFiltersChange"></choose-files>
                        <div class="form-help">建议尺寸750*750 只适用首页商品展示</div>
                      </el-form-item>
                      <el-form-item label="商品长方形主图">
                        <choose-files ref="chooseFiles" :config="choosePlatConfig" :changeEvt="formFormatFiltersChange"></choose-files>
                        <div class="form-help">建议尺寸750*1334 只适用首页商品展示和店铺商品展示</div>
                      </el-form-item>
                      <!-- <el-form-item label="商品视频">
                        <choose-files ref="chooseFiles" :config="choosePlatformVConfig" :changeEvt="formFormatFiltersChange"></choose-files>
                        <div class="form-help">目前只是支持手机端播放，时长建议10s-20s</div>
                      </el-form-item> -->
                     
                         
                       <el-form-item label="社群客服">
                          <!-- <el-select v-model="formFormatData.formData.community_type" placeholder="请选择客服类型" class="poster" @change="communitybtn">
                              <el-option :label="'社群'" :value="1">
                              </el-option>
                              <el-option :label="'客服'" :value="2">
                              </el-option>
                              <el-option :label="'公众号'" :value="3">
                              </el-option>
                              <el-option :label="'电话'" :value="4">
                              </el-option>
                          </el-select> -->
                          <el-select v-model="formFormatData.formData.community_id" placeholder="请选择" style="width:200px;" multiple>
                            <el-option v-for="(item,index) in selectValue" :key="index" :label="item.title" :value="item.id" ></el-option>
                          </el-select>
                        <div class="form-help">
                          每个商品允许选择多个服务
                          <router-link target="_blank" :to="{path:'/merchandise/community',query:{  store_user_id:$route.query.store_user_id?$route.query.store_user_id:'',
                  h_aid:$route.query.h_aid?$route.query.h_aid:'',}}">
                            <el-button type="text" class="text-primary">新建社群</el-button>
                          </router-link>|
                          <el-button type="text" @click="getCommunityList">刷新</el-button>
                        </div>
                      </el-form-item>
                       <el-form-item label="售后服务">
                          <el-radio-group v-model="formFormatData.formData.after_sales" class="wlm-form-group flex-col">
                            <el-radio :label="20">
                              支持买家申请退款
                              <el-form-item label v-if="formFormatData.formData.after_sales == 20">
                                <el-radio-group v-model="formFormatData.formData.after_sales_detail.status" class="wlm-form-group flex-col">
                                  <el-radio label="10" :disabled="formFormatData.formData.is_buy_and_give==1">未核销无论是否过期均支持退款</el-radio>
                                   <el-radio label="30">无使用的核销码支持退款(整单退)</el-radio>
                                    <div class="form-help" style="margin-bottom: 10px;">如果开启多买赠礼时，退款只能选择‘无已使用的核销码支持退款（整单退）</div>
                                  <el-radio label="20" :disabled="formFormatData.formData.validity === 10|| formFormatData.formData.is_buy_and_give==1">
                                    未核销在过期
                                    <el-input style="width:60px;" v-model.trim="formFormatData.formData.after_sales_detail.alow_day"></el-input>天
                                    <el-input style="width:60px;" v-model.trim="formFormatData.formData.after_sales_detail.alow_house"></el-input>小时前可退款
                                  </el-radio>
                                 
                                </el-radio-group>
                                <span class="form-help">当有效期付款时间不为长期使用时，才可选择未核销过期退款时间</span>
                              </el-form-item>
                            </el-radio>
                            <el-radio :label="10">不支持买家申请退款</el-radio>
                          </el-radio-group>
                        </el-form-item>
                         <el-form-item label="退款免审核" v-if="formFormatData.formData.after_sales == 20">
                            <el-radio-group v-model="formFormatData.formData.is_refund_examine ">
                              <el-radio :label="1">开启</el-radio>
                              <el-radio :label="2">关闭</el-radio>
                              <el-radio :label="3">默认</el-radio>
                            </el-radio-group>
                          </el-form-item>
                      <el-form-item label="退款路径" prop="protect">
                        <el-radio-group v-model="formFormatData.formData.refund_root" class="wlm-form-group">
                          <el-radio :label="1">退款至余额</el-radio>
                          <el-radio :label="2">原路返回</el-radio>
                          <el-radio :label="3">默认</el-radio>
                        </el-radio-group>
                      </el-form-item>
                        <el-form-item label="单独手续费开关" prop="protect">
                          <el-radio-group v-model="formFormatData.formData.refund_open" class="wlm-form-group">
                            <el-radio :label="1">开启</el-radio>
                            <el-radio :label="2">关闭</el-radio>
                          </el-radio-group>
                        </el-form-item>
                        <el-form-item label="单独设置退款手续费率" prop="protect" v-if="formFormatData.formData.refund_open==1">
                            <div class="input-slot flex-row flex-align-c flex-justify-s wlm-input-appendbox">
                              <el-input-number :controls="false"  :max="100" :precision="2" v-model="formFormatData.formData.refund_ratio">
                              </el-input-number>
                              <div class="wlm-input-append append-right">%</div>
                            </div>
                        </el-form-item>
                         <el-form-item label="搭配商品">
                          <choose-goods ref="chooseGoods" :config="chooseGoodsConfig" :changeEvt="filtersChange"></choose-goods>
                          <el-button type="primary" @click="goodsToogle">添加商品</el-button>
                          <el-table v-if="formFormatData.formData.collocation!=''" :data="formFormatData.formData.collocation" style="width: 50%;margin-top:20px">
                            <el-table-column prop="date" label="商品">
                              <template slot-scope="scope">
                                <div class="flex-row">
                                  <img class="logo" v-if="scope.row.goods.image && scope.row.goods.image" :src="scope.row.goods.image[0]['file_path']" />
                                  <div class="inner-text">
                                    <p>{{scope.row.goods.goods_name}}</p>
                                    <span>￥:{{scope.row.goods.goods_price}}</span>
                                  </div>
                                </div>
                              </template>
                            </el-table-column>
                            <el-table-column prop="date" label="库存">
                              <template slot-scope="scope">
                                <p>{{scope.row.goods.stock_num}}</p>
                              </template>
                            </el-table-column>
                            <el-table-column label="操作">
                              <template slot-scope="scope">
                                <div class="operation-group">
                                  <el-button class="wlm-text" type="text" @click="deleteTable(scope)">删除</el-button>
                                </div>
                              </template>
                            </el-table-column>
                        </el-table>
                      </el-form-item>
                         <el-form-item label="商品表单" v-if="patSetting.plugin.form.open">
                          <el-select v-model="formFormatData.formData.form_id" placeholder="请选择" @change="productbtn">
                            <el-option v-for="item in productdata" :key="item.form_id" :label="item.form_title" :value="item.form_id"></el-option>
                          </el-select>
                          <!--  -->
                          <el-button style="margin-left:10px;" v-if="formFormatData.formData.form_id" icon="el-icon-delete" circle plain @click="delMeal"></el-button>
                      </el-form-item>
                      <el-form-item label="上架时间">
                          <el-radio-group v-model="formFormatData.formData.goods_status">
                            <el-radio :label="10">立即上架</el-radio>
                            <el-radio :label="30">自定义上架时间</el-radio>
                          </el-radio-group>
                        </el-form-item>
                        <el-form-item v-if="formFormatData.formData.goods_status==30">
                          <el-date-picker v-model="formFormatData.formData.uppertime" type="datetime" align="right" value-format="timestamp"  start-placeholder="开始日期" end-placeholder="结束日期" :default-value="new Date()"></el-date-picker>
                        </el-form-item>
                        <el-form-item label="下架时间">
                          <el-radio-group v-model="formFormatData.formData.is_under" class="flex-col" @change="datetimebtn">
                            <el-radio style="margin-top:10px;" :label="10">否</el-radio>
                            <el-radio style="margin:20px 0 0" :label="20">
                              <el-date-picker v-model="formFormatData.formData.under_time"  @change="timestampbtn" type="datetime" align="right" value-format="timestamp" start-placeholder="开始日期" end-placeholder="结束日期" :default-value="new Date()"></el-date-picker>
                            </el-radio>
                            <p class="form-help">到达设定时间后，此商品自动放置仓库</p>
                          </el-radio-group>
                        </el-form-item>
                         <el-form-item label="开售时间">
                          <el-radio-group v-model="formFormatData.formData.is_open_sale">
                            <el-radio :label="0">上架即开售</el-radio>
                            <el-radio :label="1">自定义</el-radio>
                          </el-radio-group>
                          <div class="form-help">注：自定义开售时间前10分钟用户可自主预约商品接受开售提醒消息</div>
                        </el-form-item>
                         <el-form-item v-if="formFormatData.formData.is_open_sale==1">
                            <el-date-picker v-model="formFormatData.formData.open_sale_time" @change="timestampbtn" type="datetime" align="right" value-format="timestamp" start-placeholder="开始日期" end-placeholder="结束日期" :default-value="new Date()"></el-date-picker>
                        </el-form-item>
                    </el-form>
                  </div>
              </section>
        </el-tab-pane>
        <el-tab-pane label="价格库存" name="second">
             <section>
                  <div class="wlm-form-content">
                       <el-form ref="smsSettings1" :model="formFormatData.formData" :rules="formFormatData.rules" size="small" label-width="145px" class="retail-form" label-position="right">
                            <el-form-item label="商品规格">
                              <el-radio-group :disabled="$isSaleType" v-model="formFormatData.formData.spec_type"  @change="changeSpec">
                                <el-radio :label="10">单规格</el-radio>
                                <el-radio :label="20" v-if="formFormatData.formData.transport_type!=40 && formFormatData.formData.transport_type!=50">多规格</el-radio>
                                <!-- <el-radio :label="30" >多套餐</el-radio> -->
                              </el-radio-group>
                            </el-form-item>
                             <!-- <el-form-item label="限购" v-if="formFormatData.formData.spec_type==10">
                            <el-checkbox v-model="formFormatData.formData.limit_buy" :true-label="10" :false-label="20">限制每人购买数量</el-checkbox>
                            <el-input style="margin-left:10px;" v-if="formFormatData.formData.limit_buy == 10" v-model="formFormatData.formData.limit_num" placeholder="请输入限制数量"></el-input>
                            <p class="form-help">(限制用户购买商品数量，不勾选不做购买限制)</p>
                          </el-form-item> -->
                            <el-form-item label="商品结算价格">
                                <el-checkbox :true-label="20" :false-label="10" @change="settlementChange" v-model="formFormatData.formData.is_settlement">单独结算</el-checkbox>
                                <p class="form-help">商品默认结算价格以商家默认结算比例进行计算</p>
                              </el-form-item>
                              <el-form-item label="结算金额" prop="settlement" v-if="formFormatData.formData.is_settlement==20&&formFormatData.formData.spec_type == 10 && formFormatData.formData.transport_type != 50">
                                <el-input v-model="formFormatData.formData.settlement"></el-input>
                              </el-form-item>
                              <el-form-item label v-show="formFormatData.formData.spec_type == 20">
                                <MultipleSpecifications
                                  ref="multipleSpec"
                                :config="{columnData:columnDataUpdate,cardData:cardData,categoryidData:categoryidData,saleIng:$isNoSaleIng, disabled:$isSaleType, isEdit: isFormEdit,content: '进行多规格编辑并保存后，则需要重新设置更新分销佣金及会员价', filterKeys:['goods_price','line_price'] }" 
                                :transport_type= 'formFormatData.formData.transport_type' :spec_type = 'formFormatData.formData.spec_type' @limitbtn="limitbtn"></MultipleSpecifications>
                              <el-form-item label="是否同时购买" v-if="formFormatData.formData.transport_type!=60">
                                  <el-switch :inactive-value="2"  :active-value="1"  :disabled="ismeal" v-model="formFormatData.formData.meal_together_buy"></el-switch>
                                </el-form-item>
                                <el-form-item label="是否转换为套餐商品">
                                  <el-switch :inactive-value="2"  :active-value="1" v-model="formFormatData.formData.is_meal" :disabled="(formFormatData.formData.transport_type == 60 && formFormatData.formData.is_meal==1 || ismeal)"></el-switch>
                                </el-form-item>
                                   <el-form-item label="套餐商品是否显示套餐库存">
                                         <el-radio-group v-model="formFormatData.formData.meal_is_show_stock" style="margin-left:30px;">
                                            <el-radio :label="1">是</el-radio>
                                            <el-radio :label="2"> 否</el-radio>
                                          </el-radio-group>
                                           
                                </el-form-item>
                              </el-form-item>
                               <template v-if="formFormatData.formData.spec_type == 10">
                              <el-form-item label="售卖价" :prop="'sku.' + 0 + '.goods_price'" :rules="{required: true, message: '请输入售卖价', trigger: 'blur'}">
                                <div class="input-slot flex-row flex-align-c flex-justify-s wlm-input-appendbox">
                                  <el-input-number :disabled="$isSaleType" :controls="false" :min="0" v-model="formFormatData.formData['sku'][0]['goods_price']"></el-input-number>
                                  <div class="wlm-input-append append-right">元</div>
                                </div>
                              </el-form-item>
                              <el-form-item label="市场价" :prop="'sku.' + 0 + '.line_price'" :rules="{required: true, message: '请输入市场价', trigger: 'blur'}">
                                <div class="input-slot flex-row flex-align-c flex-justify-s wlm-input-appendbox">
                                  <el-input-number :controls="false" :min="0" v-model="formFormatData.formData['sku'][0]['line_price']"></el-input-number>
                                  <div class="wlm-input-append append-right">元</div>
                                </div>
                              </el-form-item>
                              <el-form-item
                                v-if="formFormatData.formData.transport_type!=30"
                                label="商品库存"
                                :prop="'sku.' + 0 + '.stock_num'"
                              :rules="{required: true, message: '请输入商品库存', trigger: 'blur'}">
                                <el-input-number
                                  :controls="false"
                                  :min="0"
                                  @input.native="clearNativeReg(formFormatData.formData['sku'][0],'stock_num')"
                                v-model.trim="formFormatData.formData['sku'][0]['stock_num']"></el-input-number>
                              </el-form-item>
                              <el-form-item
                                v-if="formFormatData.formData.transport_type==30"
                                label="选择卡密库"
                                :prop="'sku.' + 0 + '.kammi_id'"
                              :rules="{required: true, message: '请选择卡密库', trigger: 'blur'}">
                                <el-select filterable v-model="formFormatData.formData['sku'][0]['kammi_id']" >
                                  <el-option
                                      v-for="item in cardData"
                                      :disabled="item.is_select&&item.is_select==1"
                                      :key="item.kammi_id"
                                      :label="item.kammi_title"
                                      :value="item.kammi_id"></el-option>
                                </el-select>
                              </el-form-item>
                              <el-form-item v-show="formFormatData.formStep == 1" v-if="formFormatData.formData.transport_type == 50" class="inputBtn">
                                      <el-button type="primary"  style="margin:10px 0 10px 5px;" @click="libaoBtn">添加礼包商品</el-button>
                                      <el-table :data="formFormatData.formData.gift">
                                        <el-table-column label="图片" width="120">
                                              <template slot-scope="scope" >
                                                <img class="update-load"  v-if="scope['row']['image']" :src="scope.row.image&&scope.row.image.length? scope.row.image[0]['file_path'] :''" width="50" height="50" @click="uploadColumn(scope.$index)" />
                                                <div v-else class="flex-row flex-align-c flex-justify-c update-load" @click="uploadColumn(scope.$index)">
                                                  <i class="el-icon-plus avatar-uploader-icon"></i>
                                                </div>
                                                  <choose-files ref="chooseFiles" :config="chooseFilesImage" :changeEvt="uploadChange" style="display:none;"></choose-files>
                                              </template>
                                        </el-table-column>
                                        <el-table-column label="礼包商品名称" width="300">
                                                <template slot-scope="scope">
                                                      <el-input
                                                          :maxlength="100"
                                                          v-model="scope.row.title"
                                                          style="width:250px">
                                                      </el-input>
                                              </template>
                                        </el-table-column>
                                        <el-table-column label="价格" width="160">
                                          <template slot-scope="scope">
                                              <div class="temap input-slot flex-row flex-align-c flex-justify-s wlm-input-appendbox">
                                                  <el-input-number :disabled="$isSaleType" :controls=false :min="0" v-model="scope.row.price" ></el-input-number>
                                                  <div class="wlm-input-append_s append-right">元</div>
                                              </div>
                                          </template>
                                        </el-table-column>
                                        <el-table-column  label="结算价格" width="300" v-if="formFormatData.formData.is_settlement==20">
                                            <template slot-scope="scope">
                                              <div class="temap input-slot flex-row flex-align-c flex-justify-s wlm-input-appendbox">
                                            <el-input-number :disabled="$isSaleType" :controls="false" :min="0" v-model="scope.row.settlement"></el-input-number>
                                            <div class="wlm-input-append_s append-right">元</div>
                                          </div>
                                          </template>
                                        </el-table-column>
                                       <el-table-column label="核销商家" width="600" :show-overflow-tooltip="true">
                                          <template slot-scope="scope">
                                            <!-- @remove-tag="removeLabels(scope)" -->
                                            <el-select  multiple  filterable  v-model="scope.row.bus_id" placeholder="请选择核销商家" @change="removeLabels(scope)" >
                                              <el-option v-for="item in shopData" :disabled="item.storenum==0" :key="item.value" :label="item.name" :value="item.id"></el-option>
                                            </el-select>

                                             <el-select  multiple  filterable  v-model="scope.row.store_ids" placeholder="请选择门店" style="margin-left:10px;">
                                                <el-option v-for="item in storeData[scope.$index]"  :disabled="item.storenum==0" :key="item.id" :label="item.name" :value="item.id.toString()"></el-option>
                                      <!-- {{storeData[scope.$index]}} -->

                                            </el-select>
                                          </template>
                                        </el-table-column>
                                        <el-table-column label="操作" width="120">
                                            <template slot-scope="scope">
                                              <div class="operation-group">
                                                  <el-button size="mini" type="danger" @click="deleteTable1(scope.$index)">删除</el-button>
                                              </div>
                                            </template>
                                          </el-table-column>
                                  </el-table>
                              </el-form-item>
                              
                            </template>
                              <section v-if="formFormatData.showSku">
                                <el-form-item label="库存预警" v-if="formFormatData.formData.spec_type == 10">
                                  <el-input @input.native="clearNativeReg(formFormatData.formData['sku'][0],'stock_early')" v-model.trim="formFormatData.formData['sku'][0]['stock_early']"></el-input>
                                </el-form-item>
                                <el-form-item label="商品编码" v-if="formFormatData.formData.spec_type == 10">
                                  <el-input v-model.trim="formFormatData.formData['sku'][0]['goods_no']"></el-input>
                                </el-form-item>
                                  <el-form-item v-if="formFormatData.formData.transport_type === 20 && formFormatData.formData.spec_type!=20" label="商品重量">
                                  <el-input @blur="notZero(formFormatData.formData['sku'][0],'goods_weight')" @input.native="clearNativeReg(formFormatData.formData['sku'][0],'goods_weight',-1,formFormatData.formData['sku'][0]['goods_weight'],0.01)" v-model.trim="formFormatData.formData['sku'][0]['goods_weight']">
                                    <template slot="append">kg</template>
                                  </el-input>
                                </el-form-item>
                                <el-form-item label="商品详情显示销量">
                                  <el-radio-group v-model="formFormatData.formData.is_sales" class="wlm-form-group">
                                    <el-radio :label="1">显示</el-radio>
                                    <el-radio :label="2">隐藏</el-radio>
                                  </el-radio-group>
                                </el-form-item>
                                <el-form-item label="已售出数">
                                  <el-input @input.native="clearNativeReg(formFormatData.formData,'virtual_sales')" v-model.trim="formFormatData.formData.virtual_sales">
                                    <template slot="append">件</template>
                                  </el-input>
                                  <p class="form-help">前端显示已出售数等于真实销售数+此处设置的数量</p>
                                </el-form-item>
                                  <el-form-item label="生成核销码个数" v-if="formFormatData.formData.transport_type == 10 && formFormatData.formData.spec_type==10">
                                    <el-input-number @input.native="clearNativeReg(formFormatData.formData,'code_num',1)" :controls="false" :min="1" v-model.trim="formFormatData.formData.code_num"></el-input-number>
                                    <p class="form-help">购买一份商品生成核销码个数</p>
                                  </el-form-item>
                                <el-form-item label="商品详情显示库存">
                                  <el-radio-group v-model="formFormatData.formData.is_stock" class="wlm-form-group">
                                    <el-radio :label="1">显示</el-radio>
                                    <el-radio :label="2">隐藏</el-radio>
                                  </el-radio-group>
                                </el-form-item>
                                 <el-form-item label="商品减库存方式">
                                    <el-radio-group v-model="formFormatData.formData.stock_type">
                                        <el-radio :label="1">支付减库存</el-radio>
                                        <el-radio :label="2">下单减库存</el-radio>
                                    </el-radio-group>
                                </el-form-item>
                              
                              </section>

                       </el-form>
                  </div>
             </section>
        </el-tab-pane>
         <el-tab-pane label="阶梯价" name="stepprice" v-if="formFormatData.formData.transport_type == 10 || formFormatData.formData.transport_type == 20">
           <section>
                  <div class="wlm-form-content">

                       <el-form ref="smsSettings1" :model="formFormatData.formData" :rules="formFormatData.rules" size="small" label-width="145px" class="retail-form" label-position="right">
                            <el-form-item label="是否开启阶梯价">
                                <el-switch :inactive-value="2"  :active-value="1" v-model="formFormatData.formData.is_step_price" :disabled="$spec_type"></el-switch>
                                <div class="form-help">开启阶梯价后商品规格只能是单规格商品,并且阶梯价格最大五级</div>
                                <div style="width:90%;background:#D9EDF7;padding:10px;margin-top:10px;" v-if="formFormatData.formData.is_step_price==1">
                                  <div>1. 销售区间上限请按照从小到大设置，并且不能大于商品总库存。关闭示例</div>
                                      <div>  2. 开启阶梯价后，如果销售区间上限没有包含所有库存，则区间外的商品以普通价格销售</div>
                                       <div> 3. 开启阶梯价后，区间上限在移动端显示时，会自动将虚拟销量添加上 </div>
                                       <div style="color:red;"> 请勿在商品销售中时修改阶梯价信息，否则造成的任何后果请自行负责!</div>
                                </div>
                                <img  v-if="formFormatData.formData.is_step_price==1" src="../../assets/image/jietijia.png" alt="">
                            </el-form-item>
                            <el-form-item v-if="formFormatData.formData.is_step_price==1">
                              <el-button type="primary"  style="margin:10px 0 10px 5px;" @click="stepprice">添加阶梯价</el-button>
                                 <el-table :data="formFormatData.formData.step_price" style="width: 90%;margin-top:20px">
                                    <el-table-column  label="销售区间下限">
                                     <template slot-scope="scope">
                                              <el-input
                                                          v-model="scope.row.lower_limit"
                                                          style="width:250px">
                                              </el-input>
                                      </template>
                                      
                                    </el-table-column>
                                     <el-table-column  label="销售区间上限">
                                       <template slot-scope="scope">
                                              <el-input
                                                          v-model="scope.row.upper_limit"
                                                          style="width:250px">
                                                      </el-input>
                                          </template>
                                    </el-table-column>
                                     <el-table-column  label="阶梯价格">
                                      <template slot-scope="scope">
                                              <div class="temap input-slot flex-row flex-align-c flex-justify-s wlm-input-appendbox">
                                                  <el-input-number :disabled="$isSaleType" :controls=false :min="0" v-model="scope.row.step_price" ></el-input-number>
                                                  <div class="wlm-input-append_s append-right">元</div>
                                              </div>
                                          </template>
                                    </el-table-column>
                                     <el-table-column label="阶梯会员价格">
                                      <template slot-scope="scope">
                                              <div class="temap input-slot flex-row flex-align-c flex-justify-s wlm-input-appendbox">
                                                  <el-input-number :disabled="$isSaleType" :controls=false :min="0" v-model="scope.row.member_step_price" ></el-input-number>
                                                  <div class="wlm-input-append_s append-right">元</div>
                                              </div>
                                          </template>
                                    </el-table-column>
                                     <el-table-column label="删除">
                                        <template slot-scope="scope">
                                           <el-button size="mini" type="danger" @click="deleteTable2(scope.$index)">删除</el-button>
                                        </template>
                                     </el-table-column>
                                     
                              </el-table>
                            </el-form-item>
                             
                       </el-form>
                  </div>
           </section>
        </el-tab-pane>
        <el-tab-pane label="核销设置" name="third">
          <section>
                  <div class="wlm-form-content">
                    <el-form ref="smsSettings" :model="formFormatData.formData" :rules="formFormatData.rules" size="small"  label-width="145px" class="retail-form" label-position="right">
                      <el-form-item label="关联商家" prop="bus_id" v-if="this.formFormatData.formData.transport_type!=40">
                      <div style="display:flex;">
                        <el-select
                          :disabled="!!formFormatData.api['editForm']['params']['id']"
                          filterable
                          v-model="formFormatData.formData.bus_id"
                          placeholder="请选择或输入关键词搜索"
                          @change="selectChanged">
                        <el-option v-for="item in shopData" :disabled="item.storenum==0" :key="item.value" :label="item.name" :value="item.id"></el-option>
                      </el-select>

                      <el-select
                            v-model="formFormatData.formData.store_id"
                            multiple
                            collapse-tags
                            placeholder="请选择门店"
                            v-if="!!formFormatData.formData.bus_id">
                                            <el-option
                            v-for="item in store_name"
                            :disabled="item.storenum==0"
                            :value-key="item.name"
                            :key="item.value"
                                            :label="item.name"
                            :value="item.id.toString()"></el-option>
                            <!-- <div class="category-tree">
                              <el-tree ref="trees" @check="checkChange" :default-checked-keys="formFormatData.formData.category_id" node-key="category_id"
                              highlight-current :props="{label: 'name',children: 'child',isLeaf: 'leaf'}" :data="store_name" show-checkbox></el-tree>
                            </div> -->
                      </el-select>
                      <p class="form-help" v-if="formFormatData.formData.transport_type==60" style="margin-left:10px;">注：票务商品此商家仅作为展示</p>
                      </div>
                      <p class="form-help">关联商家商品保存后无法修改，请谨慎选择</p>
                      <div class="form-help" style="margin-top:4px;">
                        商家需要添加门店后才可选择
                           <router-link target="_blank" :to="{path:'/merchant/business',query:{  store_user_id:$route.query.store_user_id?$route.query.store_user_id:'',
                  h_aid:$route.query.h_aid?$route.query.h_aid:'',}}">
                          <el-button type="text" class="text-primary">添加门店</el-button>
                        </router-link>|
                        <el-button type="text" @click="shopDataGet">刷新</el-button>
                      </div>
                    </el-form-item>
                     <el-form-item label="关联供应商" prop="s_id" v-else>
                        <el-select :disabled="!!formFormatData.api['editForm']['params']['id']" filterable v-model="formFormatData.formData.s_id" placeholder="请选择或输入关键词搜索">
                          <el-option v-for="(item ,index) in supplierData" :disabled="item.storenum==0" :key="index" :label="item.name" :value="item.s_id"></el-option>
                        </el-select>
                        <p class="form-help">关联供应商商品保存后无法修改，请谨慎选择</p>
                      </el-form-item>
                     <template>
                          <el-form-item label="限购" v-if="formFormatData.formData.spec_type==10">
                            <el-checkbox v-model="formFormatData.formData.limit_buy" :true-label="10" :false-label="20">限制每人购买数量</el-checkbox>
                            <el-input style="margin-left:10px;" v-if="formFormatData.formData.limit_buy == 10" v-model="formFormatData.formData.limit_num" placeholder="请输入限制数量"></el-input>
                            <p class="form-help">(限制用户购买商品数量，不勾选不做购买限制)</p>
                          </el-form-item>
                        <el-form-item label="有效期">
                          <span>(更改有效期只是对新付款订单有效)</span>
                          <el-radio-group v-model="formFormatData.formData.effect" class="wlm-form-group flex-col" style="width:30%;">
                            <el-radio :label="10">
                              付款后立即生效
                              <el-form-item v-if="formFormatData.formData.effect == 10" label>
                                <el-radio-group v-model="formFormatData.formData.validity" class="wlm-form-group flex-col" @change="validityChange">
                                  <el-radio :label="10">生效时间起长期使用</el-radio>
                                  <el-radio :label="20">
                                    有效时间起
                                    <!-- <el-input style="width:50px;" v-model.trim="formFormatData.formData.validity_day" min='0'>
                                    </el-input>-->
                                    <el-input-number style="width:80px;" class="inputNumber" v-model="formFormatData.formData.validity_day" :controls="false" :min="1"></el-input-number>天内可使用
                                  </el-radio>
                                  <el-radio :label="30">
                                    在
                                    <el-date-picker :picker-options="pickerOptions" v-model="formFormatData.formData.validity_starttime" value-format="timestamp" type="datetimerange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']"></el-date-picker>
                                  </el-radio>
                                </el-radio-group>
                              </el-form-item>
                            </el-radio>
                            <el-radio :label="20">
                              付款后次日生效
                              <el-form-item v-if="formFormatData.formData.effect == 20" label>
                                <el-radio-group v-model="formFormatData.formData.validity" class="wlm-form-group flex-col">
                                  <el-radio :label="10">生效时间起长期使用</el-radio>
                                  <el-radio :label="20">
                                    有效时间起
                                    <!-- <el-input style="width:50px;" v-model.trim="formFormatData.formData.validity_day">
                                    </el-input>-->
                                    <el-input-number style="width:80px;" class="inputNumber" v-model="formFormatData.formData.validity_day" :controls="false" :min="1"></el-input-number>天内可使用
                                  </el-radio>
                                  <el-radio :label="30">
                                    在
                                    <el-date-picker :picker-options="pickerOptions" :default-time="['00:00:00', '23:59:59']" v-model="formFormatData.formData.validity_starttime" value-format="timestamp" type="datetimerange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
                                  </el-radio>
                                  <el-radio :label="40">
                                    付款后次日
                                    <el-input-number style="width:80px;" class="inputNumber" v-model="formFormatData.formData.validity_time" :controls="false" :min="1"></el-input-number>时起生效
                                  </el-radio>
                                </el-radio-group>
                              </el-form-item>
                            </el-radio>
                          </el-radio-group>
                        </el-form-item>
                        <!-- <el-form-item label="订单到期提醒" >
                            <el-radio-group v-model="formFormatData.formData.is_expire_tips">
                              <el-radio :label="1">开启</el-radio>
                              <el-radio :label="2">关闭</el-radio>
                            </el-radio-group>
                        </el-form-item> -->
                        <!-- <el-form-item label="" v-if="formFormatData.formData.is_expire_tips==1">
                            提前
                            <el-input-number style="width:80px;" class="inputNumber" v-model="formFormatData.formData.expire_tips" :controls="false" :min="0.01" :max="99" :precision="2"></el-input-number>天到期提醒
                        </el-form-item> -->
                      </template>
                       <!-- <el-form-item label="下单时间" v-if="formFormatData.formData.transport_type == 60 &&formFormatData.formData.spec_type!=20"> -->
                      <el-form-item label="下单时间">
                          <el-checkbox-group v-model="formFormatData.formData.place_time" @change="placetimebtn">
                              <el-checkbox label="1">每天限制购买时间</el-checkbox>
                              <el-checkbox label="2">需提前购买限制天数(此设置只针对票务商品！)</el-checkbox>
                          </el-checkbox-group>
                      <div v-if="formFormatData.formData.place_time.indexOf('1')!=-1 ">
                        <el-input-number v-model="formFormatData.formData.limit_time"  :controls="false" :min="0" :max="23"></el-input-number>
                        <div class="form-help">每天限制购买时间，每天最晚可购买时间，24小时制。(列如：18，则代表当天18点前可购买)</div>
                      </div>

                       <div v-if="formFormatData.formData.place_time.indexOf('2')!=-1 ">
                        <el-input-number  v-model="formFormatData.formData.limit_day" :controls="false" :min="1" ></el-input-number>
                        <div class="form-help">每天限制购买天数，单行输入框，填写整数，购买该商品需提前x天购买消费。</div>
                      </div>
                  </el-form-item>
                       <!-- <el-form-item label="订单到期提醒" v-if='formFormatData.formData.transport_type!=30'>
                    <el-radio-group v-model="formFormatData.formData.is_expire_tips">
                      <el-radio :label="1">开启</el-radio>
                      <el-radio :label="2">关闭</el-radio>
                    </el-radio-group>
                        </el-form-item> -->
                        <el-form-item label="" v-if="formFormatData.formData.is_expire_tips==1">
                            提前
                            <el-input-number style="width:80px;" class="inputNumber" v-model="formFormatData.formData.expire_tips" :controls="false" :min="0.01" :max="99" :precision="2"></el-input-number>天到期提醒
                        </el-form-item>
                        <el-form-item label="核销保护期" prop="protect" v-if="formFormatData.formData.transport_type == 10">
                          <el-radio-group v-model="formFormatData.formData.protect" class="wlm-form-group">
                            <el-radio :label="1">关闭</el-radio>
                            <el-radio :label="2">开启</el-radio>
                          </el-radio-group>
                        </el-form-item>
                        <el-form-item label="保护时间" v-if="formFormatData.formData.protect == 2" prop="protect_time">
                          <el-input v-model.number="formFormatData.formData.protect_time">
                            <template slot="append">小时</template>
                          </el-input>
                          <p class="form-help">核销保护期内不允许核销</p>
                        </el-form-item>
                      
                          <el-form-item label="每日核销限制" v-if='formFormatData.formData.transport_type!=30&&formFormatData.formData.transport_type!=20'>
                            <el-checkbox v-model="formFormatData.formData.is_code" :true-label="20" :false-label="10">限制每日每单核销数量</el-checkbox>
                            <el-input-number style="margin-left:10px;" v-if="formFormatData.formData.is_code == 20" :controls="false" :min="1" v-model="formFormatData.formData.code_limit" placeholder="请输入核销限制"></el-input-number>
                            <p class="form-help">(该商品每日限制核销数量)</p>
                          </el-form-item>
                           
                           <el-form-item label="指定团长可售" v-show="this.formFormatData.formData.transport_type==40">
                              <el-radio-group v-model="formFormatData.formData.leader_id">
                                <el-radio label="0">所有团长可售</el-radio>
                              </el-radio-group>
                            </el-form-item>
                             <div class="wlm-form" v-show="formFormatData.formStep == 1 && formFormatData.formData.transport_type == 20">
                                  <div class="wlm-form-header">物流信息</div>
                                  <section>
                                    <div class="wlm-form-content">
                                      <el-form ref="smsSettings2" :model="formFormatData.formData" :rules="formFormatData.rules" size="small" label-width="145px" class="retail-form" label-position="right">
                                         
                                        <el-form-item label="配送方式" prop="isexpress" v-if="formFormatData.formData.transport_type == 20">
                                          <el-checkbox :true-label="1" :false-label="0" v-model="formFormatData.formData.isexpress">快递发货</el-checkbox>
                                          <el-checkbox :true-label="1" :false-label="0" v-model="formFormatData.formData.iszt">到店自提</el-checkbox>
                                        </el-form-item>
                                        <el-form-item label="运费模板" prop="delivery_id" v-if="formFormatData.formData.isexpress == 1&&formFormatData.formData.transport_type == 20">
                                         <div style="display:flex;"> <el-select v-model="formFormatData.formData.delivery_id" placeholder="请选择">
                                            <el-option v-for="item in goodsDelivery" :key="item.delivery_id" :label="item.name" :value="item.id"></el-option>
                                          </el-select>
                                          <div style="color:red;font-size:12px;margin-left:10px;">快递满减模板对于同时购买的套餐商品只作用到具体规格，不具体到总计（件数或重量）</div></div>
                                        </el-form-item>
                                      </el-form>
                                    </div>
                                  </section>
                                </div>
                                <div class="wlm-form" v-show="formFormatData.formStep == 1 && formFormatData.formData.transport_type == 40&& patSetting.plugin.cgp.open">
                                    <div class="wlm-form-header">物流信息</div>
                                    <section>
                                      <div class="wlm-form-content">
                                        <el-form ref="smsSettings2" :model="formFormatData.formData" :rules="formFormatData.rules" size="small" label-width="145px" class="retail-form" label-position="right">
                                          <el-form-item label="配送方式" prop="isexpress">
                                            <el-checkbox :true-label="0" :false-label="1" v-model="formFormatData.formData.isexpress" disabled>到店自提</el-checkbox>
                                          </el-form-item>
                                          <el-form-item label="送达间隔天数">
                                            <el-radio-group v-model="service">
                                              <el-radio :label="1">当日到达</el-radio>
                                              <el-radio :label="2">次日到达</el-radio>
                                              <el-radio :label="3">隔日到达</el-radio>
                                              <el-radio :label="4" >自定义送达间隔天数 <el-input v-if="formFormatData.formData.service!=1 && formFormatData.formData.service!=2 &&formFormatData.formData.service!=3" v-model.number="formFormatData.formData.service_day"  style="width:100px;"></el-input>
                                              </el-radio>
                                            </el-radio-group>
                                          </el-form-item>
                                          <el-form-item label="是否开启预估送达时间">
                                            <el-radio-group v-model="formFormatData.formData.service_date_open">
                                              <el-radio :label="1">开启</el-radio>
                                              <el-radio :label="2">关闭</el-radio>
                                            </el-radio-group>
                                          </el-form-item>
                                          <el-form-item label="预估送达时间点" v-show="formFormatData.formData.service_date_open ==1">
                                            <!-- <el-input v-model="formFormatData.formData.service_date"><template slot="append">时</template></el-input> -->
                                            <div class="input-slot flex-row flex-align-c flex-justify-s wlm-input-appendbox">
                                                <el-input-number v-model="formFormatData.formData.service_date" :controls="false" :min="1" :max="24">
                                                </el-input-number>
                                                <div class="wlm-input-append append-right">时</div>
                                            </div>
                                          </el-form-item>
                                        </el-form>
                                      </div>
                                    </section>
                                  </div>
                            </el-form>
                  </div>
          </section>
        </el-tab-pane>
        <el-tab-pane label="商品描述" name="fourth">
           <section>
                  <div class="wlm-form-content">
                    <el-form ref="smsSettings" :model="formFormatData.formData" :rules="formFormatData.rules" size="small"  label-width="145px" class="retail-form" label-position="right">
                           <template v-if="formFormatData.showNormal">
              <el-form-item label="商品卖点">
                <!-- <el-input v-model="formFormatData.formData.selling_point" maxlength="50"></el-input>
                <div class="form-help">商品详情页展示卖点信息，不超过50个字符</div> -->
                  <el-input v-model="formFormatData.formData.selling_point" style="width:80%;"></el-input>

              </el-form-item>
              <el-form-item label="主图视频">
                <choose-files ref="chooseFiles" :config="choosePlatformVConfig" :changeEvt="formFormatFiltersChange"></choose-files>
                <div class="form-help">目前只是支持手机端播放，时长建议10s-20s</div>
                <!-- {{formFormatData.formData.video}} -->
              </el-form-item>
                <el-form-item label="背景音乐" prop="time">
                              <choose-files ref="chooseFiles" :config="choosePlatmaginConfig" :changeEvt="formFormatFiltersChange"></choose-files>
                        </el-form-item>
              <el-form-item label="是否加入视频列表" v-if="formFormatData.formData.video !='' && patSetting.plugin.videolist.open">
                  <el-radio-group  v-model="formFormatData.formData.is_video_list">
                    <el-radio :label="1">是</el-radio>
                    <el-radio :label="2">否</el-radio>
                  </el-radio-group>
              </el-form-item>
              <el-form-item label="是否开启弹幕" v-if="formFormatData.formData.is_video_list==1">
                  <el-radio-group  v-model="formFormatData.formData.is_video_danmaku">
                    <el-radio :label="1">是</el-radio>
                    <el-radio :label="2">否</el-radio>
                  </el-radio-group>
              </el-form-item>
              <el-form-item label="商品服务">
                <el-select multiple v-model="formFormatData.formData.serve" placeholder="请选择">
                  <el-option v-for="item in goodsServeData" :key="item.id" :label="item.title" :value="`${item.id}`"></el-option>
                </el-select>
                <div class="form-help">
                  每个商品允许选择多个标签
                     <router-link target="_blank" :to="{path:'/merchandise/servingMerchandise',query:{  store_user_id:$route.query.store_user_id?$route.query.store_user_id:'',
                  h_aid:$route.query.h_aid?$route.query.h_aid:'',}}">
                    <el-button type="text" class="text-primary">添加商品服务</el-button>
                  </router-link>|
                  <el-button type="text" @click="getGoodsServeList">刷新</el-button>
                </div>
              </el-form-item>
              <el-form-item label="商品参数">
                <el-select v-model="formFormatData.formData.param" placeholder="请选择">
                  <el-option v-for="item in goodsParamData" :key="item.id" :label="item.title" :value="`${item.id}`"></el-option>
                </el-select>
                 <el-button style="margin-left:10px;" v-if="formFormatData.formData.param" icon="el-icon-delete" circle plain @click="delparam"></el-button>
                <div class="form-help">
                  每个商品允许选择单个参数
                   <router-link target="_blank" :to="{path:'/merchandise/parameterMerchandise',query:{  store_user_id:$route.query.store_user_id?$route.query.store_user_id:'',
                  h_aid:$route.query.h_aid?$route.query.h_aid:'',}}">
                    <el-button type="text" class="text-primary">新建参数</el-button>
                  </router-link>|
                  <el-button type="text" @click="getGoodsGoodsParamList">刷新</el-button>
                </div>
              </el-form-item>
               <!-- <el-form-item label="商品表单" v-if="patSetting.plugin.form.open">
                          <el-select v-model="formFormatData.formData.form_id" placeholder="请选择" @change="productbtn">
                            <el-option v-for="item in productdata" :key="item.form_id" :label="item.form_title" :value="item.form_id"></el-option>
                          </el-select>
                          <el-button style="margin-left:10px;" v-if="formFormatData.formData.form_id" icon="el-icon-delete" circle plain @click="delMeal"></el-button>
                      </el-form-item> -->
              <el-form-item label="购买提醒">
                <el-input type="textarea" v-model="formFormatData.formData.buy_tip" style="width:80%;"></el-input>
              </el-form-item>
               <el-form-item label="商品详情感兴趣人数">
                <el-radio-group v-model="formFormatData.formData.is_like" class="wlm-form-group">
                  <el-radio :label="1">显示</el-radio>
                  <el-radio :label="2">隐藏</el-radio>
                </el-radio-group>
              </el-form-item>
               <el-form-item label="虚拟感兴趣人数">
                <el-input v-model.trim="formFormatData.formData.virtual_like"></el-input>
                <p class="form-help">前端显示感兴趣人数等于真实感兴趣人数+此处设置的数量</p>
              </el-form-item>
               <el-form-item label="增加感兴趣人数" prop="time">
                            <el-input  v-model.trim="formFormatData.formData.false_look_rand" >
                            </el-input>
                            <div class="form-help">格式1|10随机最小值|随机最大值，0为真实增加</div>
                </el-form-item>
              
               <el-form-item label="推荐商品">
                <el-radio-group v-model="formFormatData.formData.rec_type">
                  <el-radio :label="1">本类商品</el-radio>
                  <el-radio :label="2">本店商品</el-radio>
                  <el-radio :label="3">自定义推荐</el-radio>
                  <el-radio :label="4">无</el-radio>
                </el-radio-group>
              </el-form-item>
               <el-form-item label="信息隐藏" >
                   <el-checkbox-group v-model="formFormatData.formData.hide_info" >
                           <el-checkbox v-for="role in roledata" :label="role.value" :key="role.value">
                             {{role.label}}
                            </el-checkbox>
                      </el-checkbox-group>
              </el-form-item>
            
            </template>
            
                      <div class="wlm-form" >
                        <div class="wlm-form-header">商品详情</div>
                        <section>
                          <div class="wlm-form-content">
                            <el-form
                              ref="smsSettings5"
                              :model="formFormatData.formData"
                              :rules="formFormatData.rules"
                              size="small"
                              label-width="145px"
                              class="retail-form"
                            label-position="right">
                              <el-form-item label>
                        
                                  <ueditor
                                        v-if="isFirst"
                                        :ueditorChange="shopInfoChange"
                                        :ueditorList="ueditorList"
                                        :bindIndex="1"
                                        :defaultMsg='defaultMsg1'
                                        :config='{initialFrameWidth: null,initialFrameHeight: 350}'
                                        ref="by_know"></ueditor>
                              </el-form-item>
                            </el-form>
                          </div>
                        </section>
                      </div>
                      <div class="wlm-form" >
                        <div class="wlm-form-header">购买须知</div>
                        <section>
                          <div class="wlm-form-content">
                            <el-form
                                ref="smsSettings5"
                                :model="formFormatData.formData"
                                :rules="formFormatData.rules"
                                size="small"
                                label-width="145px"
                                class="retail-form"
                                          label-position="right">
                                            <el-form-item label>
                                           
                                  <ueditor
                                        v-if="isDelay"
                                        :ueditorChange="serverInfoChange"
                                        :ueditorList="ueditorList"
                                        :bindIndex="1"
                                        :defaultMsg='defaultMsg2'
                                        :config='{initialFrameWidth: null,initialFrameHeight: 500}'
                                        ref="content"></ueditor>
                              </el-form-item>
                            </el-form>
                          </div>
                        </section>
                      </div>
                    </el-form>
                  </div>
           </section>
        </el-tab-pane>
        <el-tab-pane label="分享设置" name="share">
            <section>
                  <div class="wlm-form-content">
                    <el-form ref="smsSettings" :model="formFormatData.formData" :rules="formFormatData.rules" size="small"  label-width="145px" class="retail-form" label-position="right">
                           <el-form-item label="分享标题">
                             <el-input  v-model="formFormatData.formData.share_title" style="width:80%;"></el-input>
                           </el-form-item>
                           <el-form-item label="分享描述">
                             <el-input v-model="formFormatData.formData.share_description" style="width:80%;"></el-input>
                           </el-form-item>
                         
            <el-form-item label="公众号分享图片">
                <choose-files ref="chooseFiles" :config="choosefenConfig" :changeEvt="formFormatFiltersChange"></choose-files>
                        <div class="form-help">建议尺寸100*100 </div>
            </el-form-item>
            <el-form-item label="小程序分享图片">
                <choose-files ref="chooseFiles" :config="choosesappConfig" :changeEvt="formFormatFiltersChange"></choose-files>
                        <div class="form-help">建议尺寸500*400</div>
            </el-form-item>
            <el-form-item label="商品海报" v-if="patSetting.plugin.diyposter.open" class="poster">
              <el-select clearable v-model="formFormatData.formData.goods_diy_id" placeholder="请选择商品海报">
                <el-option v-for="item in diyPosterData.goods" :key="item.diy_id" :label="item.posterName" :value="`${item.diy_id}`"></el-option>
              </el-select>
              <el-select clearable v-if="patSetting.plugin.groups.open" v-model="formFormatData.formData.groups_diy_id" placeholder="请选择拼团海报">
                <el-option v-for="item in diyPosterData.groups" :key="item.diy_id" :label="item.posterName" :value="`${item.diy_id}`"></el-option>
              </el-select>
              <el-select clearable v-if="patSetting.plugin.spike.open" v-model="formFormatData.formData.spike_diy_id" placeholder="请选择秒杀海报">
                <el-option v-for="item in diyPosterData.spike" :key="item.diy_id" :label="item.posterName" :value="`${item.diy_id}`"></el-option>
              </el-select>
              <div class="form-help">
                每个海报类型允许选择单个海报
                <router-link target="_blank" :to="{path:'/application/custormPosterList',query:{
                     store_user_id:$route.query.store_user_id?$route.query.store_user_id:'',
                  h_aid:$route.query.h_aid?$route.query.h_aid:''}}">
                  <el-button type="text" class="text-primary">新建海报</el-button>
                </router-link>|
                <el-button type="text" @click="getDiyPosterList">刷新</el-button>
              </div>
            </el-form-item>
                    </el-form>
                  </div>
            </section>

        </el-tab-pane>
        <el-tab-pane label="其他设置" name="other">
             <section>
                  <div class="wlm-form-content">
                    <el-form ref="smsSettings" :model="formFormatData.formData" :rules="formFormatData.rules" size="small"  label-width="145px" class="retail-form" label-position="right">
                        <el-form-item label="订单预约使用" v-if="formFormatData.formData.transport_type==10 && patSetting.plugin.reserve.open && formFormatData.formData.transport_type!=60">
                          <div style="display:flex;align-items:center;">
                              <el-switch :inactive-value="2"  :active-value="1"   v-model="formFormatData.formData.is_reservation" @change="openswith"></el-switch>
                              <div style="margin-left:10px;color:red;">下单后需预约才可使用，操作不可逆请慎重选择。</div>
                          </div>
                            <div v-if="formFormatData.formData.is_reservation==1">
                            <el-checkbox :true-label="1" :false-label="2" v-model="formFormatData.formData.reservation_audit">
                              预约审核
                                <el-tooltip content="开启后预约需要商家审核。" placement="top">
                                  <i class="el-icon-question"></i>
                                </el-tooltip>
                              </el-checkbox>
                              <el-checkbox :true-label="1" :false-label="2" v-model="formFormatData.formData.is_pre_shopping">
                              购物前预约
                                  <el-tooltip content="购买前选择预约时间。" placement="top">
                                      <i class="el-icon-question"></i>
                                  </el-tooltip>
                              </el-checkbox>
                

                              <el-checkbox :true-label="1" :false-label="2" v-model="formFormatData.formData.is_force_code">
                              预约即核销
                                  <el-tooltip content="预约成功后自动核销。" placement="top">
                                      <i class="el-icon-question"></i>
                                  </el-tooltip>
                              </el-checkbox>

                            </div>
                            </el-form-item>
                            <el-form-item label="购买限制" >
                                  <el-radio-group v-model="formFormatData.formData.handle">
                                    <el-radio :label="1">无需限制</el-radio>
                                    <el-radio :label="2">关注公众号</el-radio>
                                    <!-- <el-radio :label="3">需要分享</el-radio> -->
                                  </el-radio-group>
                            </el-form-item>
                              <el-form-item label="佣金到账类型" v-if="formFormatData.formData.transport_type==10 || formFormatData.formData.transport_type==60">
                                  <el-radio-group v-model="formFormatData.formData.pay_after_dealer_settlement" style="margin-left:20px;">
                                    <el-radio :label="1">立即到账</el-radio>
                                    <el-radio :label="2">订单完成到账</el-radio>
                                    <el-radio :label="3">默认</el-radio>
                                  </el-radio-group>
                            </el-form-item>
                               <el-form-item label="关注公众号回复引导语" v-if="formFormatData.formData.handle==2">
                                 <el-input type="textarea" v-model="formFormatData.formData.leading_words" style="width:80%;"></el-input>
                               </el-form-item>
                             <div class="wlm-form" >
                                  <div class="wlm-form-header">积分信息</div>
                                  <section>
                                    <div class="wlm-form-content">
                                      <el-form ref="smsSettings4" :model="formFormatData.formData" :rules="formFormatData.rules" size="small" label-width="145px" class="retail-form" label-position="right">
                                        <el-form-item label="积分抵扣">
                                          <el-radio-group v-model="formFormatData.formData.balance.rebate" class="wlm-form-group">
                                            <el-radio :label="2">关闭</el-radio>
                                            <el-radio :label="1">开启</el-radio>
                                          </el-radio-group>
                                        </el-form-item>
                                        <el-form-item label="最高抵扣" >
                                          <el-input v-model="formFormatData.formData.balance.max_rebate_money">
                                            <template slot="append">元</template>
                                          </el-input>
                                          <p class="form-help">不填则为默认最高抵扣</p>
                                        </el-form-item>
                                        <el-form-item label="购买商品赠送积分" prop="bucket">
                                          <el-input @input.native="clearNativeReg(formFormatData.formData.balance,'give_integral',-1,-1,0.01)" v-model="formFormatData.formData.balance.give_integral">
                                            <template slot="append">积分</template>
                                          </el-input>
                                        </el-form-item>
                                      </el-form>
                                    </div>
                                  </section>
                                    <div class="wlm-form-header">广告信息</div>
                                    <section>
                                    <div class="wlm-form-content">
                                      <el-form ref="smsSettings6" :model="formFormatData.formData" :rules="formFormatData.rules" size="small" label-width="145px" class="retail-form" label-position="right">
                                         <el-form-item label="广告设置">
                                              <el-radio-group v-model="formFormatData.formData.adsense_open" @change="adsenseOpen(formFormatData.formData.adsense_open)">
                                                  <el-radio :label="1">关闭</el-radio>
                                                  <el-radio :label="2">单独设置</el-radio>
                                                  <el-radio :label="3">系统设置</el-radio>
                                              </el-radio-group>
                                         </el-form-item>
                                        <el-form-item label="广告位图片" v-if="formFormatData.formData.adsense_open==2">
                                        <choose-files ref="chooseFiles" :config="choosefenweiConfig" :changeEvt="formFormatFiltersChange"></choose-files>
                                                <div class="form-help">建议尺寸690*150 </div>
                                        </el-form-item>
                                        <el-form-item label="广告位链接" v-if="formFormatData.formData.adsense_open==2">
                                             <choose-link ref="chooseIconLink" :config="chooseLinkConfig" :changeEvt="uploadIconFileChange"></choose-link>
                                              <el-input v-model="formFormatData.formData.adsense_link"  @focus="uploadFileToggle"  placeholder="请选择链接"></el-input>
                                        </el-form-item>
                                      </el-form>
                                    </div>
                                  </section>
                                </div>
                    </el-form>
                  </div>
             </section>
        </el-tab-pane>
        <el-tab-pane label="票务设置" name="ticketing" v-if="formFormatData.formData.transport_type == 60">
                <section>
                  <div class="wlm-form-content">
                    <el-form ref="smsSettings" :model="formFormatData.formData" :rules="formFormatData.rules" size="small"  label-width="145px" class="retail-form" label-position="right">
                         <el-form-item label="是否开启价格日历" prop="id_card">
                            <el-radio-group v-model="formFormatData.formData.is_calendar_price">
                                  <el-radio :label="1">开启</el-radio>
                                  <el-radio :label="2">关闭</el-radio>
                              </el-radio-group>
                              <div></div>
                        </el-form-item>
                      
                         <el-form-item label="是否需要身份证" prop="id_card">
                            <el-radio-group v-model="formFormatData.formData.id_card">
                                  <el-radio :label="1">需要</el-radio>
                                  <el-radio :label="2">不需要</el-radio>
                              </el-radio-group>
                        </el-form-item>
                        <!-- <el-form-item label="是否预售" prop="pre_sale">
                            <el-radio-group v-model="formFormatData.formData.pre_sale">
                                  <el-radio :label="1">需要</el-radio>
                                  <el-radio :label="2">不需要</el-radio>
                              </el-radio-group>
                        </el-form-item> -->
                          <el-form-item label="预售时间" prop="pre_sale" v-if="formFormatData.formData.pre_sale==1">
                            <el-date-picker
                              v-model="formFormatData.formData.pre_sale_time_start"
                              type="date"
                              placeholder="选择开始日期">
                              </el-date-picker>- <el-date-picker
                              v-model="formFormatData.formData.pre_sale_time_end"
                              type="date"
                              placeholder="选择结束日期">
                              </el-date-picker>
                        </el-form-item>
                        <el-form-item label="是否开启快递" >
                          <el-radio-group v-model="formFormatData.formData.isexpress" >
                              <el-radio :label="1">开启</el-radio>
                              <el-radio :label="0">关闭</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-form>
                  </div>
                </section>
        </el-tab-pane>
        <el-tab-pane label="多买赠礼" name="gifts" v-if="formFormatData.formData.transport_type == 10 && formFormatData.formData.spec_type==10">
             <section>
                  <div class="wlm-form-content">
                    <el-form ref="smsSettings" :model="formFormatData.formData" :rules="formFormatData.rules" size="small"  label-width="145px" class="retail-form" label-position="right">
                            <el-form-item label="是否开启多买多赠礼">
                                <el-switch :inactive-value="2"  :active-value="1" v-model="formFormatData.formData.is_buy_and_give" @change="buygivebtn" :disabled="$buygive"></el-switch>
                            </el-form-item>
                            <el-form-item label="赠送规则" v-if="formFormatData.formData.is_buy_and_give==1">
                                <div style="margin-bottom:20px;" class="input-slot flex-row flex-align-c flex-justify-s wlm-input-appendbox envelope-input-number" v-for="(item, index) in formFormatData.formData.buy_and_give_rules" :key="index">
                                  <div class="wlm-input-append append-left">满</div> 
                                  <el-input-number :controls="false" :min="1" :max="100" v-model="item.purchase"></el-input-number>
                                  <div class="wlm-input-append append-right">件</div>
                                  <div class="wlm-input-append append-left">赠送</div>
                                  <el-input-number :controls="false" :min="1" :max="100" v-model="item.give"></el-input-number>
                                  <div class="wlm-input-append append-right">件</div>
                                  <el-button style="margin-left:10px;" icon="el-icon-delete" circle plain @click="deltc(index)"></el-button>
                                </div>
                                <el-button type="primary" @click="addtc">添加规则</el-button>
                              </el-form-item>
                                <el-form-item label="赠送减库存加销量" v-if="formFormatData.formData.is_buy_and_give==1">
                                      <el-switch :inactive-value="2"  :active-value="1" v-model="formFormatData.formData.is_calculate_sales"></el-switch>
                                </el-form-item>
                                  <el-form-item label="赠送结算" v-if="formFormatData.formData.is_buy_and_give==1">
                                         <el-radio-group v-model="formFormatData.formData.give_settlement_rules.status" class="wlm-form-group flex-col" style="width:30%;">
                                              <el-radio label="1">不结算</el-radio>
                                              <el-radio label="2">与当前商品结算一致</el-radio>
                                              <el-radio label="3">单独结算
                                                <el-input-number v-model="formFormatData.formData.give_settlement_rules.money" placeholder="" :controls="false"></el-input-number>
                                                元</el-radio>
                                            </el-radio-group>
                                </el-form-item>

                    </el-form>
                  </div>
              </section>
        </el-tab-pane>
      </el-tabs>
     </div>
    <div class="wlm-fixed-btn flex-row flex-align-c flex-justify-c">
      <!-- <el-button size="small" type="primary" @click="nextStep">{{`${formFormatData.formStep === 2 ?'上一步':'下一步'}`}},编辑商品详情</el-button> -->
      <el-button size="small" type="primary" @click="saveForm" :disabled="loading" :loading="loading">保存</el-button>
    </div>

  </div>
</template>

<script>
import dayjs from 'dayjs'
import { Base64 } from 'js-base64'
import upload from '@/components/Upload/index'
import ChooseGoods from '@/components/ChooseGoods/index'
import ChooseFiles from '@/components/ChooseFiles/index'
import channelSourceLoding from './components/channelSourceLoding'
import ChooseLink from '@/components/ChooseLink/index'
import ueditor from '@/components/Ueditor/index'
import MultipleSpecifications from '@/components/MultipleSpecifications/index'
import power from '@/mixins/power'
import {
  categoryIndex,
  goodsServeListAll,
  goodsParamListAll,
  goodsAdd,
  goodsGet,
  goodsDelivery,
  goodsEdit,
  communityList,
  kammiSelected,
  ticketGoodsAll,
  getTicketGoodsZwy,
  goodsRichTextHandle
} from '@/api/merchandise'
import {
  shopIndex,
  businessIndex,
  formpageIndex,
  servicesList
} from '@/api/merchant'
import {
  getSupplierList
} from '@/api/commityBuy'
import {
  posterLists,getGiftStore
} from '@/api/application'
import mixins from '@/mixins/mixins'
export default {
  mixins: [mixins.getters('Form'), power],
  name: 'ManagementUserAdd',
  components: {
    ChooseGoods,
    upload,
    ChooseFiles,
    ueditor,
    MultipleSpecifications,
    ChooseLink,
    channelSourceLoding
  },
  directives: {

  },
  computed: {
    service: {
      get() {
        let { service } = this.formFormatData.formData
        if (this.formFormatData.formData.service > 3) {
          service = 4
        }
        return service
      },
      set(val) {
        this.formFormatData.formData.service = val
        this.formFormatData.formData.service_day = val
      }
    },
    $isSaleType() {
      return (!(this.formFormatData.formData.sale_type === 0 && this.formFormatData.formData.cashback_id === 0) && this.isFormEdit)
    },
    $isNoSaleIng() {
      return this.formFormatData.formData.sale_type === 0
    },
    isStock() {
      return (this.formFormatData.formData['sku'][0]['stock_early'] === '' || this.formFormatData.formData['sku'][0]['stock_num'] === '') || (this.formFormatData.formData['sku'][0]['stock_early'] > this.formFormatData.formData['sku'][0]['stock_num'])
    },
    columnDataUpdate() {
      return this.columnData
    },
    type() {
      return this.$route.query.type && this.$route.query.type == 40
    },
    $spec_type(){
      return ((this.formFormatData.formData.transport_type==10 || this.formFormatData.formData.transport_type==20) && this.formFormatData.formData.spec_type==20)||this.formFormatData.formData.is_buy_and_give==1
    },
    $buygive(){
      return this.formFormatData.formData.is_step_price==1
    }
  },
  created() {
    console.log('loading++++++++++++++++++++++++++++++', this.loading)
    this.$nextTick(() => {
        console.log("sssss8888888888888888",this.formFormatData.formData.transport_type)

      this.categoryGet()
      this.getGoodsServeList()
      this.getGoodsGoodsParamList()
      this.productbtn()
      this.communitybtn()
      if (this.patSetting.plugin.diyposter.open) {
        this.getDiyPosterList()
      }
      this.getCommunityList()
      this.shopDataGet()
      goodsDelivery().then((response) => {
        const { data: { data: msgData = [] } } = response
        this.goodsDelivery = msgData
      })
    })
    if (this.$route.query.buss_id == -1) {
      getSupplierList({ status: 1 }).then((response) => {
        const { data: { data: msgData = [] } } = response
        this.supplierData = msgData.data
        console.log(this.supplierData)
      })
    } else {
      shopIndex({ is_page: '2', bus_id: this.$route.query.buss_id }).then(res => {
        this.store_name = res.data.data
      })
    }
  },
  watch: {
    'formFormatData.formData.service': {
      handler(val) {
        console.log('sssssssffffffffffff', val)
        if (val != 1 && val != 2 && val != 3) {
          this.formFormatData.formData.service_day = val
        }
      },
      immediate: true
    },
    //监听表单字段，如果没有选择，前端会传form_id=''到后端,编辑时后端会反form_id=0，这里就是处理这种情况
    'formFormatData.formData.form_id':{
      handler(newData, oldData){
        if(newData==0){
          this.formFormatData.formData.form_id=''
        }
      },
       immediate: true,
        deep: false
    },
     'formFormatData.formData.transport_type':{
      handler(val){
        if(this.$route.query.id && val==60){
          this.ticketGoodsAll()
        }
      },
       immediate: true,
        deep: false
    },
    //监听礼包商品数据，进来请求接口
    'formFormatData.formData.gift':{
      handler(newData, oldData){
        console.log('newData',newData);
          this.businbtn(newData);
          // this.removeLabels()
        //    getGiftStore({data:newData}).then(res=>{
        //   if(res.data.code==1){
        //     this.storeData = res.data.data;
        //     console.log("0000000000fffffffffffff",this.formFormatData.formData.gift)
        //   }
        // })
    },
     immediate: true,
        deep: false
    }
    

  },
  data() {
    var checkCategory = (rule, value, callback) => {
      // 验证前从树节点获取值
      // this.formFormatData.formData.category_id = this.$refs.trees.getCheckedKeys()
      const category_id = this.formFormatData.formData.category_id
      const { message } = rule
      if (!Array.isArray(category_id) || (Array.isArray(category_id) && category_id.length === 0)) {
        return callback(new Error(`${message}！~`))
      } else {
        callback()
      }
    }

    var checkExpress = (rule, value, callback) => {
      // 验证取值
      const isexpress = this.formFormatData.formData.isexpress
      const iszt = this.formFormatData.formData.iszt
      const { message } = rule
      if (isexpress === 0 && iszt === 0) {
        return callback(new Error(`${message}！~`))
      } else {
        callback()
      }
    }
    var checkImg = (rule, value, callback) => {
      const { message } = rule
      const image = this.formFormatData.formData.image
      if (Array.isArray(image) && image.length === 0) {
        return callback(new Error(`${message}！~`))
      } else {
        callback()
      }
    }
    return {
      loading:false,
      syncMaterialLoding:false,
      progressNum:0,
    roledata:[
      {label:'商家信息',value:'business'},
      {label:'购买须知',value:'buyKnow'},
      {label:'商品详情',value:'goodsInfo'},
      {label:'商品评价',value:'evaluate'},
      {label:'价格说明',value:'priceDescription'},
      {label:'下架时间',value:'downTime'},
      {label:'限购',value:'limitBuy'},
      ],
    activeName: 'first',
      isFirst: false,
      isDelay: false,
      supplierData: [],
      ismeal:false,
      selectValue:[],
      // category_array: [],
      chooseGoodsConfig: {
        type: ['chooseGoods'],
        model: 'normal',
        goods_type: 'all',
        // unique: true,
        disabled: [{
          label: 'goods_id',
          value: Number(this.$route.query.id)
        }],
        initList: []
      },
      chooseFilesConfig: {
        type: ['image'],
        model: 'normal',
        initList: [],
        file_type: 'image'
      },
      pickerOptions: {
        disabledDate(time) {
          return time.getTime() < Date.now() - 8.64e7
        }
      },
         // 加载进度
      ProgressBar: 0,
      // 加载是否开启
      visible: false,
      checkedKey: [],
      xiajia: 1,
      cardData: [],
      myProps: {
        value: 'category_id',
        label: 'name',
        children: 'child'
      },
      chooseLinkConfig: {
        type: ['chooseLink'],
        initList: [],
        link_type: '1'
      },
      category_name: [],
      store_name: [],
      // store_name_s:[],
      category_obj: [],
      ueditorList: [],
      categoryData: [],
      categoryidData:[],
      goodsServeData: [],
      goodsParamData: [],
      diyPosterData: {
        goods: [],
        groups: [],
        spike: []
      },
      communityData: [],
      goodsDelivery: [],
      productdata: [],
      shopData: [],
      defaultMsg2: '',
      defaultMsg1: '',
      chooseBgConfig: {
        type: ['image'],
        model: 'display',
        uploadConfig: {
          limit: 1,
          isMore: true,
          model: 'display'
        },
        isUnique: true,
        initList: [],
        isShowList: true,
        file_type: 'image',
        bindKey: {
          key: 'straight_image',
          model: 'img'
        }
      },
      choosesappConfig:{
         type: ['image'],
        model: 'display',
        uploadConfig: {
          limit: 1,
          isMore: true,
          model: 'display'
        },
        isUnique: true,
        initList: [],
        isShowList: true,
        file_type: 'image',
        bindKey: {
          key: 'sapp_img',
          model: 'img'
        }
      },
      choosefenConfig:{
           type: ['image'],
        model: 'display',
        uploadConfig: {
          limit: 1,
          isMore: true,
          model: 'display'
        },
        isUnique: true,
        initList: [],
        isShowList: true,
        file_type: 'image',
        bindKey: {
          key: 'wechat_img',
          model: 'img'
        }
      },
      choosefenweiConfig:{
         type: ['image'],
        model: 'display',
        uploadConfig: {
          limit: 1,
          isMore: true,
          model: 'display'
        },
        isUnique: true,
        initList: [],
        isShowList: true,
        file_type: 'image',
        bindKey: {
          key: 'adsense_image',
          model: 'img'
        }
      },
      chooseFilesImage: {
        type: ['image'],
        model: 'display',
        uploadConfig: {
          limit: 1,
          isMore: true,
          model: 'display'
        },
        isUnique: true,
        initList: [],
        isShowList: true,
        file_type: 'image',
        bindKey: {
          key: 'image',
          model: 'img'
        }
      },
      choosePlatConfig: {
        type: ['image'],
        model: 'display',
        uploadConfig: {
          limit: 1,
          isMore: true,
          model: 'display'
        },
        initList: [],
        isShowList: true,
        file_type: 'image',
        bindKey: {
          key: 'long_image',
          model: 'img'
        }
      },
      choosePlatformConfig: {
        type: ['image'],
        model: 'display',
        uploadConfig: {
          limit: 10,
          isMore: true,
          model: 'display'
        },
        initList:[],
        isShowList: true,
        file_type: 'image',
        bindKey: {
          key: 'image',
          model: 'img'
        }
      },
      //背景音乐
            choosePlatmaginConfig:{
                type: ['audio'],
                model: 'display',
                uploadConfig: {
                limit: 1,
                isMore: true,
                model: 'display'
                },
                initList: [],
                isShowList: true,
                file_type: 'audio',
                bindKey: {
                key: 'music',
                model: 'img'
                }
            },
      choosePlatformVConfig: {
        type: ['video'],
        model: 'display',
        uploadConfig: {
          limit: 1,
          model: 'display'
        },
        initList: [],
        isShowList: true,
        file_type: 'video',
        bindKey: {
          key: 'video',
          model: 'video'
        }
      },
      defaultProps: {
        children: 'children',
        label: 'label'
      },
      columnData: [{
        label: '售卖价',
        key: 'goods_price',
        background: {
          cellStyle: 'background:#fff;',
          headerStyle: 'background:#f2f2f2;color:#909399;'
        }
      }, {
        label: '市场价',
        key: 'line_price',
        background: {
          cellStyle: 'background:#fff;',
          headerStyle: 'background:#f2f2f2;color:#909399;'
        }
      }, {
        label: '商品编码',
        key: 'goods_no',
        background: {
          cellStyle: 'background:#fff;',
          headerStyle: 'background:#f2f2f2;color:#909399;'
        }
      }, {
        label: '商品库存',
        key: 'stock_num',
        background: {
          cellStyle: 'background:#fff;',
          headerStyle: 'background:#f2f2f2;color:#909399;'
        }
      }, {
        label: '库存预警',
        key: 'stock_early',
        background: {
          cellStyle: 'background:#fff;',
          headerStyle: 'background:#f2f2f2;color:#909399;'
        }
      },{
        label: '限购数量',
        key: 'limit_num',
        background: {
          cellStyle: 'background:#fff;',
          headerStyle: 'background:#f2f2f2;color:#909399;'
        }
      },{
        label: '是否开启限购',
        key: 'limit_buy',
        background: {
          cellStyle: 'background:#fff;',
          headerStyle: 'background:#f2f2f2;color:#909399;'
        }
      },
      {
        label: '生成核销码个数',
        key: 'code_num',
        background: {
          cellStyle: 'background:#fff;',
          headerStyle: 'background:#f2f2f2;color:#909399;'
        }
      }
      ],
      formFormatData: {
        key: ['smsSettings', 'smsSettings1', 'smsSettings2', 'smsSettings3', 'smsSettings4', 'smsSettings5','smsSettings6'],
        model: {
          isReset: true
        },
        api: {
          editForm: {
            api: goodsGet,
            params: {
              id: ''
            },
            filters: {
              choose: {
                bindInit: ['chooseGoodsConfig']
              },
              img: {
                bindInit: ['choosePlatformConfig', 'choosePlatConfig', 'chooseBgConfig', 'chooseFilesImage','choosePlatmaginConfig','choosefenConfig','choosesappConfig','choosefenweiConfig']
              },
              video: {
                bindInit: ['choosePlatformVConfig']
              }
            },
            noFilter: ['category_name']
          },
          submitForm: this.$route.query.id ? goodsEdit : goodsAdd
        },
        formStep: 1,
        showNormal: true,
        showPrice: true,
        showOther: true,
        showSku: true,
        formData: {
          adsense_link:'',
          is_buy_and_give:2,//是否开启多买赠礼；1：开启；2：关闭
          buy_and_give_rules:[{purchase:'',give:''}],
          is_calculate_sales:2,//赠送减库存加销量；1：开启；2关闭
          give_settlement_rules: {//赠送结算规则
            status: '1',
            money: ''
          },
          is_step_price:2,//阶梯价
          is_calendar_price:2,
          adsense_open:3,
          id_card:2,
          pre_sale:2,
          pre_sale_time_start:'',
          pre_sale_time_end:'',
          isexpress:2,
          share_title:'',
          share_description:'',
          sapp_img:[],
          wechat_img:[],
          adsense_image:[],
          handle:1,
          pay_after_dealer_settlement:3,
          leading_words:'',
          music:[],
          false_look_rand:'',
          weixin_reply_content:'',
          weixin_reply_content_id:0,
          limit_time:'',
          limit_day:'',
          place_time:[],
          ticketType:1,
          // community_type:'',
          community_id:[],
          by_know: '',
          content: '',
          meal_together_buy: '2',
          is_reservation: 2, // 1开启 2关闭
          reservation_audit: 2,
          // reservation_rules: 2,
          is_force_code: 2,
          is_pre_shopping: 2,
          is_meal: '1',
          meal_is_show_stock:2,
          source:['2','3','4','7','9'],
          meal: [],
          is_audit: '',
          store_id: [],
          gift: [],
          step_price:[],
          refund_root: 3,
          refund_open: 2,
          refund_ratio: '',
          leader_id: '0',
          service: 1, // 送达间隔天数
          service_day: 0,
          service_date: '', // 预估送达时间点
          service_date_open: 2,
          rec_type: 4,
          collocation: [],
          goods_name: '',
          balance: { rebate: 2, max_rebate_money: '', give_integral: '' },
          buy_tip: '',
          is_settlement: 10,
          settlement: '',
          sale_type: '',
          cashback_id: 0,
          category_id: [],
          bus_id: [],
          s_id: '',
          image:[],
          // image: [{"file_id":5701,"storage":"local","group_id":0,"file_url":"","file_name":"sync\/16012054564008610.png","file_size":354291,"file_type":"image","extension":"png","is_user":0,"is_delete":0,"wxapp_id":40,"create_time":"2020-09-27 19:17:37","attach_id":0,"originname":"\/16012054564008610.png","remark":"0","file_path":"https:\/\/weixin.weliam.cn\/addons\/weliam_areashop\/web\/uploads\/40\/sync\/16012054564008610.png"}],
          long_image: [],
          straight_image: [],
          video: [],
          transport_type: this.$route.query.type && this.$route.query.type == 40 ? 40 : 10,
          serve: [],
          goods_diy_id: '',
          groups_diy_id: '',
          spike_diy_id: '',
          uppertime: +dayjs().set('hour',23).set('minute',59).set('second',59),
          open_sale_time:'',
          under_time: +dayjs().set('hour',23).set('minute',59).set('second',59),
          is_under: 10,
          limit_buy: 20,
          limit_num: '',
          code_limit: '',
          is_code: '',
          effect: 10,
          effecttime: '',
          validity: 10,
          validity_day: '',
          validity_time: '',
          expire_tips: '',
          is_expire_tips: 2,
          validity_starttime: [],
          param: '',
          selling_point: '',
          spec_type: 10,
          is_video_list: 2,
          is_video_danmaku: 2,
          hide_info:[],
          sku: [{
            goods_price: '',
            line_price: '',
            stock_num: '',
            stock_early: '',
            goods_no: '',
            goods_weight: '',
            kammi_id: '',
            settlement: '',
            goodsid_fk:'',
            limit_buy:10,
            limit_num:'',
            code_num:'1',
          }],
          deduct_stock_type: '',

          delivery_id: '',
          form_id: '',
          isexpress: 0,
          iszt: 1,
          goods_status: 10,
          is_open_sale:0,
          sales_initial: '',
          goods_sort: '',
          after_sales: 10,
          is_refund_examine:3,
          is_sales: 1,
          is_stock: 1,
          stock_type:1,
          virtual_sales: '',
          is_like: 1,
          virtual_like: '',
          code_num: '1',
          after_sales_detail: {
            status: '10',
            alow_house: '',
            alow_day: ''
          },
          protect: 1,
          protect_time: 1
        },
        rules: {
          goods_name: [
            {
              message: '请输入商品名称',
              required: true,
              trigger: 'change'
            }
          ],
          goods_price: [
            {
              message: '请输入售卖价',
              required: true,
              trigger: 'change'
            }
          ],
          line_price: [
            {
              message: '请输入市场价',
              required: true,
              trigger: 'change'
            }
          ],
          stock_num: [
            {
              message: '请输入商品库存',
              required: true,
              trigger: 'change'
            }
          ],
          isexpress: [
            {
              message: '配送方式至少选择一种!~',
              required: true,
              validator: checkExpress,
              trigger: 'change'
            }
          ],
          settlement: [
            {
              message: '请输入结算金额',
              required: true,
              trigger: 'change'
            }
          ],
          bus_id: [
            // {
            //   message: '请选择关联商家',
            //   required: true,
            //   trigger: 'change'
            // }
          ],
          s_id: [
            {
              message: '请选择关联供应商',
              required: true,
              trigger: 'change'
            }
          ],
          category_id: [
            {
              message: '请选择商品分类',
              required: true,
              validator: checkCategory,
              trigger: 'blur'
            }
          ],
          goodsImages: [
            {
              message: '请选择商品图片',
              required: true,
              validator: checkImg,
              trigger: 'blur'
            }
          ],
          delivery_id: [
            {
              message: '请选择运费模板',
              required: true,
              trigger: 'change'
            }
          ],
          code_num: [
            {
              message: '核销码个数需大于0',
              required: true,
              trigger: 'change'
            }
          ],
          protect_time: [
            { type: 'number', message: '保护时间需为数字', trigger: 'blur' }
          ]
          // max_rebate_money: [
          //   {
          //     // message: '最高抵扣不能大于售卖价格',
          //     validator: checkMaxRebateMoney

          //   }
          // ]
        }
      },
      newData: [],

    }
  },
  mounted() {
    this.$nextTick(() => {
      setTimeout(() => {
        this.isDelay = true
      }, 3500)
      setTimeout(() => {
        this.isFirst = true
      }, 900)
    })
    //  console.log("this.$route.query.id",this.$route.query.id)
  },
  methods: {
    adsenseOpen(e){
      if(e!=2){
        this.formFormatData.formData.adsense_link=''
        this.formFormatData.formData.adsense_image=[]
      }
    },
   uploadFileToggle(){
      this.$refs.chooseIconLink.toggle()
   },
   //链接回调
   uploadIconFileChange(files) {
     const { key } = files
      if(key==='ChooseLink'){
          const { currentRow: [file_path],displayData: [{  path}] } = files
         if (file_path || path) {
         this.formFormatData.formData.adsense_link = file_path || path
      }else{
        this.$message.error('请选择链接~!')
      }
      }
    },
    addtc() {
      if(this.formFormatData.formData.buy_and_give_rules.length<5){
      this.formFormatData.formData.buy_and_give_rules.push({ purchase: '', give: '' })
      }else{
        this.$message.error("最多添加5个规则！")
      }
    },
    deltc(index) {
      this.formFormatData.formData.buy_and_give_rules.splice(index, 1)
    },
    buygivebtn(index){
      console.log("福袋后发多岁",index)
      if(index==1){
        this.formFormatData.formData.after_sales = 20
        this.formFormatData.formData.after_sales_detail.status = '30'
      }
    },
    //接收子组件传过来的参数
    limitbtn(emitdata){
      console.log("惊魂甫定是否打开己方的",emitdata)
    },
    //点击核销商家下拉框请求接口拿对应门店
     businbtn(data = [],handle_index = '',handle_store = []){
      //  console.log('aaaaaaaaaa',handle_index,handle_store);
       data = Base64.encode(JSON.stringify(data.length != 0 ? data : this.formFormatData.formData.gift)) 
       let store_ids = [];
       let handle_store_ = JSON.parse(JSON.stringify(handle_store))

        getGiftStore({arr:data}).then(res=>{
          if(res.data.code==1){
            this.storeData = res.data.data
          }
        })
    },
    //删除商家重新请求
    removeLabels(vak){
        let store_ids = [],
        handle_index = vak.$index,//对应礼包项下标
        handle_store = vak.row.store_ids,//对应已选择门店
        handle_store_ = JSON.parse(JSON.stringify(handle_store));//深拷贝一次对应已选择的门店
        let gifrdata=  Base64.encode(JSON.stringify(this.formFormatData.formData.gift)) 
        getGiftStore({arr:gifrdata}).then(res=>{
          if(res.data.code==1){
            //获取接口对应门店数据
            this.storeData = res.data.data
            //重新匹配已选处理门店
            if(handle_store !== [] && !!this.storeData[handle_index]){
              //获取一列门店ID（能选择的门店IDS）
              store_ids = this.storeData[handle_index].map(item=>item.id.toString());
                console.log('store_ids',store_ids);

              handle_store.map((value,key) => {
                console.log('value',value);
                if(store_ids.indexOf(value) == -1){
                  delete handle_store_[key];
                }
              })
            }

            if(handle_store_ instanceof Object){
                handle_store = Object.values(handle_store_)
            }else if(handle_store_ instanceof Array){
                handle_store = handle_store_
            }
            // console.log('handle_store_',handle_store_,handle_store_ instanceof Object);
            console.log('handle_store_',handle_store);
            vak.row.store_ids = handle_store
          }
        })
    },
    stepprice(){
      if(this.formFormatData.formData.step_price.length<5){
        this.formFormatData.formData.step_price.push({
            step_price:'',//阶梯价格
            member_step_price:'',//阶梯会员价
            lower_limit:'',//销售区间下限
            upper_limit:'',//销售区间上限
      })
      }else{
        return this.$message.error("阶梯价最大增加5个！")

      }
    },
    ticketbtn(value){
      
      if(this.formFormatData.formData.ticketType==2){
        this.ticketGoodsAll()
      //   ticketGoodsAll({type:this.formFormatData.formData.ticketType}).then(res=>{
      //   console.log("+988888888888888888888888888888874",res.data.data)
      //   const { data: { code, msg } } = res
      //   this.categoryidData = res.data.data
      //   if(code==0){
      //     this.$message.error("请完善票务配置信息！")
      //   }
      // })
      }else{
        this.ticketGoodsAll()
      }
    },
    placetimebtn(){
      console.log("this.formFormatData.formData.place_time++++++++++",this.formFormatData.formData.place_time)
      if(this.formFormatData.formData.place_time.length>=0){
         this.formFormatData.formData.limit_time = ''
      this.formFormatData.formData.limit_day = ''
      }
    },
    goodsfk(val){
      console.log("ddd5555555555555555555555555",this.formFormatData.formData.ticketType)
      getTicketGoodsZwy({id:val}).then(res=>{
        if(this.formFormatData.formData.transport_type == 60){
          //是票务商品时，用于数据回显
          this.formFormatData.formData.goods_name = res.data.data.goods_name
          //如果是自我游，购买须知是另外一个字段
          this.defaultMsg2 = this.formFormatData.formData.ticketType==1?res.data.data.orderDesc:res.data.data.orderPolicy
          this.defaultMsg1 = res.data.data.content
          console.log("********************",res.data.data.image)
          //请求接口后，图片回显
          this.choosePlatformConfig.initList = res.data.data.image
          this.formFormatData.formData.image = res.data.data.image
          this.formFormatData.formData.sku.map(item=>{
            item.line_price= res.data.data.marketPrice
            item.goods_price= res.data.data.salePrice
          })
        }
      })
    },
    delMeal(){
      this.formFormatData.formData.form_id = ''
    },
    delparam(){
      this.formFormatData.formData.param = ''
    },
    communitybtn(){
      servicesList({list_rows: 'all' }).then(res=>{
        this.selectValue = res.data.data
      })
    },
    productbtn(value) {
      console.log('sddddaasaaaa', value)
      formpageIndex({ all: 1, type: 2 }).then(res => {
        this.productdata = res.data.data
      })
    },
    datetimebtn() {
      if (this.formFormatData.formData.is_under == 10) {
        // this.formFormatData.formData.under_time =  +dayjs().set('hour',23).set('minute',59).set('second',59)
        this.formFormatData.formData.under_time = ''
      }else{
        this.formFormatData.formData.under_time =  +dayjs().set('hour',23).set('minute',59).set('second',59)
      }
    },
    timestampbtn() {
      if (this.formFormatData.formData.under_time != '') {
        this.formFormatData.formData.is_under = 20
      }
    },
    selectChanged(value) {
      console.log('value', value)
      shopIndex({ is_page: '2', bus_id: value }).then(res => {
        this.store_name = res.data.data
        this.formFormatData.formData.store_id = ''
        console.log(' this.store_name', this.store_name)
        console.log('res', res)
      })
    },
    openswith() {
      this.$confirm('若修改此开关，会影响到已下单用户的核销体验，请不要随意修改!', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.formFormatData.formData.is_reservation == 1 ? this.formFormatData.formData.is_reservation = 1 : this.formFormatData.formData.is_reservation = 2
        //核销商品并且开启订单预约使用时，关闭同时购买和是否转换为套餐商品
        if(this.formFormatData.formData.is_reservation == 1){
          if(this.formFormatData.formData.spec_type==20 && this.formFormatData.formData.transport_type == 10){
          this.formFormatData.formData.meal_together_buy=2
          this.formFormatData.formData.is_meal=2
          this.ismeal = true
        }
        }else{
          this.ismeal = false
        }
        
      }).catch(() => {
        this.formFormatData.formData.is_reservation == 1 ? this.formFormatData.formData.is_reservation = 2 : this.formFormatData.formData.is_reservation = 1
      })
    },
    shopInfoChange(msg) {
      this.defaultMsg1 = msg
    },
    serverInfoChange(msg) {
      this.defaultMsg2 = msg
    },
    currentImg($index) {
      // return this.baseForm.spectable[$index] ? this.baseForm.spectable[$index]['spec_thumb'] || 'none' : 'none'
    },
    uploadChange({ displayData = [] }) {
      if (this.$index !== -1 && displayData.length > 0) {
        this.formFormatData.formData.gift[this.$index].image = displayData
      }
    },
    uploadColumn(index) {
      this.$refs.chooseFiles.toggle()
      this.$index = index
    },
    // addGoods() {
    //   this.formFormatData.formData.meal.push({
    //     meal_title: '',
    //     meal_settlement: '',
    //     meal_price: '',
    //     meal_stock: '',
    //     meal_stock_tip: '',
    //     meal_source: '' })
    // },
    getNewTableData(newData) {
      this.newData = newData
    },
    shopDataGet() {
      businessIndex({ list_rows: 'all' }).then((response) => {
        const { data: { data: msgData = [] } } = response
        this.shopData = msgData
      })
      this.formFormatData.formData.transport_type == 40 && getSupplierList({ status: 1 }).then((response) => {
        const { data: { data: msgData = [] } } = response
        this.supplierData = msgData.data
        console.log(this.supplierData)
      })
    },
    getDiyPosterList() {
      posterLists({ local: '2', all: true }).then((response) => {
        const { data: { data: msgData = [] } } = response
        msgData.map(item => {
          if (item.class === 1) {
            this.diyPosterData.goods.push(item)
          } else if (item.class === 4) {
            this.diyPosterData.groups.push(item)
          } else if (item.class === 3) {
            this.diyPosterData.spike.push(item)
          }
        })
        this.diyPosterData.goods = msgData
      })
    },
    getGoodsGoodsParamList() {
      goodsParamListAll().then((response) => {
        const { data: { data: msgData = [] } } = response
        this.goodsParamData = msgData
      })
    },
    getCommunityList() {
      // communityList({ list_rows: 'all' }).then((response) => {
      //   const { data: { data: msgData = [] } } = response
      //   this.communityData = msgData
      // })
      this.communitybtn()
    },
    getGoodsServeList() {
      goodsServeListAll().then((response) => {
        const { data: { data: msgData = [] } } = response
        this.goodsServeData = msgData
      })
    },
    validityChange(validity) {
      if (validity === 10) {
        this.formFormatData.formData.after_sales_detail.status = '10'
      }
    },
    removeTag(tag) {
      this.formFormatData.formData.category_id.splice(0, 1)
      // setCheckedKeys(this.formFormatData.formData.category_id)
      this.$refs.trees.setCheckedKeys(this.formFormatData.formData.category_id)
      // this.$refs.tree.setCheckedKeys(this.formFormatData.formData.category_id)
    },

    checkChange(check, checkedNodes) {
      console.log(check, 'check')
      console.log(checkedNodes, 'checkedNodes')
      console.log(this.formFormatData.formData.category_id, 'category_id')
      console.log(this.category_name, 'this.category_name')
      this.formFormatData.formData.category_id = checkedNodes.checkedKeys
      const result = []
      checkedNodes.checkedNodes.map(item => {
        result.push(item.name)
      })
      this.category_name = result
      // const index = this.formFormatData.formData.category_id.findIndex(item => {
      //   return item === check.category_id
      // })
      // if (index !== -1) {
      //   this.formFormatData.formData.category_id.splice(index, 1)
      //   this.category_name.splice(index, 1)
      // } else {
      //   this.formFormatData.formData.category_id.push(check.category_id)
      //   this.category_name.push(check.name)
      // }
    },
    filtersChange(val) {
      // this.currentRow = val.currentRow
      const displayData = val.displayData
      const result = []
      displayData.map(item => {
        const newData = { image: [{ file_path: item.image[0]['file_path'] }], goods_name: item.goods_name, goods_id: item.goods_id, stock_num: item.stock, goods_price: item.goods_min_price }
        result.push({ goods: newData, goods_id: item.goods_id })
      })
      this.formFormatData.formData.collocation.push(...result)
    },
    deleteTable(scope) {
      this.formFormatData.formData.collocation.splice(scope.$index, 1)
    },
    deleteTable1(index) {
      this.formFormatData.formData.gift.splice(index, 1)
    },
    deleteTable2(index) {
      this.formFormatData.formData.step_price.splice(index, 1)
    },
    goodsToogle() {
      const result = []
      this.formFormatData.formData.collocation.map(item => {
        result.push(Number(item.goods_id))
      })
      this.$refs.chooseGoods.currentRow = result
      this.$refs.chooseGoods.toggle()
    },
    libaoBtn() {
      console.log('555555555555555555555', this.formFormatData.formData.gift)
      this.formFormatData.formData.gift.push({
        image: '',
        title: '',
        price: '',
        settlement: '',
        bus_id: []
      })
    },

    handleDelete(index, row) {
      // console.log(index, row);
      row.splice(index, 1)
    },
    categoryChange(category_array) {
      if (category_array.length > 1) {
        const [category_id] = category_array.slice(-1)
        this.formFormatData.formData.category_id = [category_id]
      } else {
        this.$message.error('不可选择一级商品分类!~')
        this.formFormatData.formData.category_id = []
        this.category_array = []
      }
    },
    categoryGet() {
      categoryIndex().then((response) => {
        const { data: { data: msgData = [] } } = response
        // if (msgData.length > 0) {
        //   msgData.map(item => {
        //     const isParent = (item.parent_id === 0)
        //     if (isParent) {
        //       item.disabled = true
        //     }
        //   })
        // }
        this.categoryData = msgData
      })
    },
    nextStep() {
      console.log(this.cardData)
      // if ((this.formFormatData.formData.spec_type === 10) && this.isStock) {
      //   this.$message.error('库存预警必须小于库存数')
      // } else {
      //   this.formFormatData.formStep = this.formFormatData.formStep === 2 ? 1 : 2
      // }
      this.formFormatData.formStep = this.formFormatData.formStep === 2 ? 1 : 2
    },
    settlementChange(val) {
      // spec_type 20多规格
      console.log('sssssssssssssssssssss', val, this.formFormatData.formData.spec_type)
      if (val === 10 && this.formFormatData.formData.spec_type === 20) {
        // this.columnData.splice(this.columnData.length - 1, 1)
        this.columnData.pop()
      } else if (val === 20 && this.formFormatData.formData.spec_type === 20) {
        // this.columnData.push({
        //   label: '结算金额',
        //   key: 'settlement',
        //   background: {
        //     cellStyle: 'background:#fff;',
        //     headerStyle: 'background:#f2f2f2;color:#909399;'
        //   }
        // })
        let a = false
        for (var i in this.columnData) {
          console.log('1111111111111111111', this.columnData[i].key)
          if (this.columnData[i].key == 'settlement') {
            a = true
            break
          }
        }
        if (a == false) {
          this.columnData.push({
            label: '结算金额',
            key: 'settlement',
            background: {
              cellStyle: 'background:#fff;',
              headerStyle: 'background:#f2f2f2;color:#909399;'
            }
          })
        }
        console.log('aaaaaaaaaaaaaaaaaaaa', this.columnData)
      }
      // if(val === 20 && this.formFormatData.formData.spec_type === 20){
      //   this.columnData.push({
      //     label: '结算金额',
      //     key: 'settlement',
      //     background: {
      //       cellStyle: 'background:#fff;',
      //       headerStyle: 'background:#f2f2f2;color:#909399;'
      //     }
      //   })
      // }
    },
    multipleSpecChange() {
      if (this.formFormatData.formData.transport_type === 20) {
        // 实物商品
        this.columnData = [{
          label: '售卖价(建议不要填0，否则无法参与活动!)',
          key: 'goods_price',
          background: {
            cellStyle: 'background:#fff;',
            headerStyle: 'background:#f2f2f2;color:#909399;'
          }
        }, {
          label: '市场价',
          key: 'line_price',
          background: {
            cellStyle: 'background:#fff;',
            headerStyle: 'background:#f2f2f2;color:#909399;'
          }
        }, {
          label: '商品编码',
          key: 'goods_no',
          background: {
            cellStyle: 'background:#fff;',
            headerStyle: 'background:#f2f2f2;color:#909399;'
          }
        }, {
          label: '商品库存',
          key: 'stock_num',
          background: {
            cellStyle: 'background:#fff;',
            headerStyle: 'background:#f2f2f2;color:#909399;'
          }
        }, {
          label: '库存预警',
          key: 'stock_early',
          background: {
            cellStyle: 'background:#fff;',
            headerStyle: 'background:#f2f2f2;color:#909399;'
          }
        }, {
          label: '商品重量',
          key: 'goods_weight',
          background: {
            cellStyle: 'background:#fff;',
            headerStyle: 'background:#f2f2f2;color:#909399;'
          }
        },
        {
        label: '限购数量',
        key: 'limit_num',
        background: {
          cellStyle: 'background:#fff;',
          headerStyle: 'background:#f2f2f2;color:#909399;'
        }
      },
        {
        label: '是否开启限购',
        key: 'limit_buy',
        background: {
          cellStyle: 'background:#fff;',
          headerStyle: 'background:#f2f2f2;color:#909399;'
        }
      },
      ]
      } else if (this.formFormatData.formData.transport_type === 10) {
        this.columnData = [{
          label: '售卖价',
          key: 'goods_price',
          background: {
            cellStyle: 'background:#fff;',
            headerStyle: 'background:#f2f2f2;color:#909399;'
          }
        }, {
          label: '市场价',
          key: 'line_price',
          background: {
            cellStyle: 'background:#fff;',
            headerStyle: 'background:#f2f2f2;color:#909399;'
          }
        }, {
          label: '商品编码',
          key: 'goods_no',
          background: {
            cellStyle: 'background:#fff;',
            headerStyle: 'background:#f2f2f2;color:#909399;'
          }
        }, {
          label: '商品库存',
          key: 'stock_num',
          background: {
            cellStyle: 'background:#fff;',
            headerStyle: 'background:#f2f2f2;color:#909399;'
          }
        }, {
          label: '库存预警',
          key: 'stock_early',
          background: {
            cellStyle: 'background:#fff;',
            headerStyle: 'background:#f2f2f2;color:#909399;'
          }
        },
        {
        label: '限购数量',
        key: 'limit_num',
        background: {
          cellStyle: 'background:#fff;',
          headerStyle: 'background:#f2f2f2;color:#909399;'
        }
      },{
        label: '是否开启限购',
        key: 'limit_buy',
        background: {
          cellStyle: 'background:#fff;',
          headerStyle: 'background:#f2f2f2;color:#909399;'
        }
      },
        {
        label: '生成核销码个数',
        key: 'code_num',
        background: {
          cellStyle: 'background:#fff;',
          headerStyle: 'background:#f2f2f2;color:#909399;'
        }
      }
      ]
      } else if (this.formFormatData.formData.transport_type === 30) {
        this.getKamiList()
        this.columnData = [{
          label: '售卖价',
          key: 'goods_price',
          background: {
            cellStyle: 'background:#fff;',
            headerStyle: 'background:#f2f2f2;color:#909399;'
          }
        }, {
          label: '市场价',
          key: 'line_price',
          background: {
            cellStyle: 'background:#fff;',
            headerStyle: 'background:#f2f2f2;color:#909399;'
          }
        }, {
          label: '商品编码',
          key: 'goods_no',
          background: {
            cellStyle: 'background:#fff;',
            headerStyle: 'background:#f2f2f2;color:#909399;'
          }
        }, {
          label: '卡密库',
          key: 'kammi_id',
          background: {
            cellStyle: 'background:#fff;',
            headerStyle: 'background:#f2f2f2;color:#909399;'
          }
        }, {
          label: '库存预警',
          key: 'stock_early',
          background: {
            cellStyle: 'background:#fff;',
            headerStyle: 'background:#f2f2f2;color:#909399;'
          }
        },
        {
        label: '限购数量',
        key: 'limit_num',
        background: {
          cellStyle: 'background:#fff;',
          headerStyle: 'background:#f2f2f2;color:#909399;'
        }
      },
        {
        label: '是否开启限购',
        key: 'limit_buy',
        background: {
          cellStyle: 'background:#fff;',
          headerStyle: 'background:#f2f2f2;color:#909399;'
        }
      }]
      }else if(this.formFormatData.formData.transport_type === 60){
          this.columnData = [{
          label: '票务种类',
          key: 'goodsid_fk',
          background: {
            cellStyle: 'background:#fff;',
            headerStyle: 'background:#f2f2f2;color:#909399;'
          }
        },{
          label: '售卖价',
          key: 'goods_price',
          background: {
            cellStyle: 'background:#fff;',
            headerStyle: 'background:#f2f2f2;color:#909399;'
          }
        }, {
          label: '市场价',
          key: 'line_price',
          background: {
            cellStyle: 'background:#fff;',
            headerStyle: 'background:#f2f2f2;color:#909399;'
          }
        }, {
          label: '商品编码',
          key: 'goods_no',
          background: {
            cellStyle: 'background:#fff;',
            headerStyle: 'background:#f2f2f2;color:#909399;'
          }
        }, {
          label: '商品库存',
          key: 'stock_num',
          background: {
            cellStyle: 'background:#fff;',
            headerStyle: 'background:#f2f2f2;color:#909399;'
          }
        }, {
          label: '库存预警',
          key: 'stock_early',
          background: {
            cellStyle: 'background:#fff;',
            headerStyle: 'background:#f2f2f2;color:#909399;'
          }
        }, {
          label: '商品重量',
          key: 'goods_weight',
          background: {
            cellStyle: 'background:#fff;',
            headerStyle: 'background:#f2f2f2;color:#909399;'
          }
        },
        {
        label: '限购数量',
        key: 'limit_num',
        background: {
          cellStyle: 'background:#fff;',
          headerStyle: 'background:#f2f2f2;color:#909399;'
        }
      },
        {
        label: '是否开启限购',
        key: 'limit_buy',
        background: {
          cellStyle: 'background:#fff;',
          headerStyle: 'background:#f2f2f2;color:#909399;'
        }
      }]
      }
      // 点击多规格时会重置table框厘米的title，所以需要判断一下是否勾选了单独结算，如果勾选了单独结算则将结算金额PUSH进table框的title对象里面，
      // 就可以完美解决先点击单独结算再点击多规格没有结算金额一栏的问题。
      if (this.formFormatData.formData.is_settlement == 20) {
        this.columnData.push({
          label: '结算金额',
          key: 'settlement',
          background: {
            cellStyle: 'background:#fff;',
            headerStyle: 'background:#f2f2f2;color:#909399;'
          }
        })
      }

      this.$refs.multipleSpec.columnData = this.columnData
    },
    formFormatCallBack(data, type, response) {
             console.log('*********************', data)
             console.log('12356454粉丝开发', type)

      if (type === 'editForm') {
        console.log('formFormatCallBack editForm')
        const { data: { data: { skuData } } } = response
        const { content, by_know, sku, category_name, is_settlement } = data
        this.defaultMsg2 = by_know
        this.defaultMsg1 = content
        if (skuData !== '' && skuData) {
          const skuDataParse = JSON.parse(skuData)
          skuDataParse.sku = sku
          const selectData = {}
          const goodsData  = {}
          // this.ticketGoodsAll()
          sku.map((item, index) => {
            // console.log("甲方的解放军JFJF",is_settlement)
            selectData[index] = item.kammi_id
            goodsData[index] = item.goodsid_fk
            this.$refs.multipleSpec.limit_buy = item.limit_buy
          })
          // console.log("ssssssssssssssssssss7777777777777777------------", this.$refs.multipleSpec)
          this.$refs.multipleSpec.selectData = selectData
          this.$refs.multipleSpec.goodsData = goodsData
          // console.log('skuDataParse', skuDataParse)
          this.$refs.multipleSpec.baseForm = skuDataParse
        }
       
        if (Array.isArray(category_name) && category_name.length > 0) {
          this.category_name = category_name
        }
        this.multipleSpecChange()
        //这个在回调里导致把columnData中的最后一个元素删除掉了
        // this.settlementChange(is_settlement)
      }
    },
    saveForm() {
      console.log('saveForm啊哈哈哈哈哈哈哈哈哈哈啊哈哈',this.formFormatData.formData.sku)
      let goodsPrice = []
      if (this.formFormatData.formData.spec_type === 20) {
        console.log('888888888888888 this.formFormatData.formData.spec_type')
        // hack
        this.formFormatData.formData.sku = this.$refs.multipleSpec.joinSpec()
        if (!(this.formFormatData.formData.sku.length > 0) && this.formFormatData.formData.spec_type != 30) {
          this.$message.error('请填写商品规格项~!')
          return
        }
        this.formFormatData.formData.skuData = JSON.stringify(this.$refs.multipleSpec.baseForm)
        JSON.parse(this.formFormatData.formData.skuData).spectable.forEach(item => {
          item.forEach(item1 => {
            // console.log("值便没有？？？？",item1)
            goodsPrice.push(item1.goods_price)
          })
        })
        goodsPrice.sort((a, b) => {
          return a - b
        })

        goodsPrice = goodsPrice[0]
      }
      // console.log('saveForm啊哈哈哈哈哈哈哈哈哈哈啊哈哈22222',this.formFormatData.formData.sku)
      // return 
    
       
      let value
      if (this.formFormatData.formData.spec_type == 10) {
        value = this.formFormatData.formData.sku[0].goods_price
      } else {
        // value = JSON.parse(JSON.stringify(goodsPrice))
        value = goodsPrice
      }
      if (Number(this.formFormatData.formData.balance.max_rebate_money) > Number(value) && this.formFormatData.formData.balance.rebate!=2) {
        this.$message.error('最高抵扣不能大于售卖价')
        return
      }
      if (this.formFormatData.formData.transport_type == 40) {
        this.formFormatData.formData.bus_id = -1
      }
      if (this.formFormatData.formData.service != 1 && this.formFormatData.formData.service != 2 && this.formFormatData.formData.service != 3) {
        this.formFormatData.formData.service = this.formFormatData.formData.service_day
      }
      this.formFormatData.formData.content = this.defaultMsg1
      this.formFormatData.formData.by_know = this.defaultMsg2

      let falg = true
      let falgs = true
      this.formFormatData.formData.sku.forEach(item => {
        console.log('aaaaaaaaaa222222',item,this.formFormatData.formData.sku)
        !item.kammi_id && (falg = false)
      })
      this.formFormatData.formData.sku.forEach(item => {
        !item.settlement && (falgs = false)
        console.log('ddddddddddddddddddeeeeeeeeeee', falgs)
      })
      console.log("打赢大一佛挡杀佛的",this.formFormatData.formData['sku'])
      //  if( this.formFormatData.formData['sku'][0]['kammi_id'] == '' && (this.formFormatData.formData.spec_type === 20 && this.formFormatData.formData.transport_type==30)){
      //    this.$message.error('请选择卡密库！')
      //       return
      // }
      if((this.formFormatData.formData.transport_type==60 && this.formFormatData.formData.spec_type === 20) && this.formFormatData.formData['sku'][0]['goodsid_fk'] == ''){
         this.$message.error('请选择票务种类！')
            return
      }
      if (!falg && this.formFormatData.formData.transport_type == 30) {
        this.$message.error('请选择卡密库！')
        return
      }
      if (this.formFormatData.formData.settlement == '' && this.formFormatData.formData.is_settlement == 20 &&
           this.formFormatData.formData.spec_type != 20 && this.formFormatData.formData.gift.settlement == '' && (!falgs && this.formFormatData.formData.transport_type == 30)) {
        this.$message.error('请输入结算金额！')
        return
      }
      if(this.formFormatData.formData.spec_type==20 && this.formFormatData.formData.transport_type==10 && this.formFormatData.formData['sku'][0]['code_num']==''){
        this.$message.error("请输入生成核销码个数！")
        return
      }
            //  console.log(":很久佛挡杀佛的科技属发的",Number.isInteger(Number(this.formFormatData.formData['sku'][0]['code_num'])))
            //判断核销码个数是否是大于等于1的整数
      if(this.formFormatData.formData.spec_type==20 && this.formFormatData.formData.transport_type==10 && !(Number.isInteger(Number(this.formFormatData.formData['sku'][0]['code_num'])))){
        this.$message.error("生成核销码个数只能为大于等于1的整数！")
        return
      }
      // if(!falgs && this.formFormatData.formData.transport_type == 30){
      //       this.$message.error('请输入结算金额！')
      //         return
      // }

      if (this.formFormatData.formData.goods_name == '') {
        this.$message.error('请输入商品名称！')
        return
      }
      if (this.formFormatData.formData.image.length == 0) {
        this.$message.error('请选择商品图！')
        return
      }
      if (this.formFormatData.formData.bus_id == '') {
        this.$message.error('请选择关联商家！')
        return
      }
      if (this.formFormatData.formData.s_id == '' && this.formFormatData.formData.transport_type == 40) {
        this.$message.error('请选择供货商！')
        return
      }
      // if (this.formFormatData.formData.store_id == '' && this.formFormatData.formData.transport_type != 40) {
      //   this.$message.error('请选择门店！')
      //   return
      // }
      if (this.formFormatData.formData.category_id == '') {
        this.$message.error('请选择商品分类！')
        return
      }

      if (this.formFormatData.formData.transport_type == 50 && this.formFormatData.formData.gift.length == 0) {
        this.$message.error('请添加礼包商品！')
        return
      }
      if (this.formFormatData.formData.video == '') {
        this.formFormatData.formData.is_video_list = '2'
      }
      if(this.formFormatData.formData.is_buy_and_give==2){
        // console.log("风刀霜剑放到计算",this.formFormatData.formData)
        this.formFormatData.formData.buy_and_give_rules=[{purchase:'',give:''}]
        this.formFormatData.formData.is_calculate_sales=2
        this.formFormatData.formData.give_settlement_rules={status: '1',money: ''}
        console.log("发多岁就很烦的手机号发多岁",this.formFormatData.formData)
      }
      // if (this.formFormatData.formData['sku'][0]['goods_price'] == '' && this.formFormatData.formData['sku'][0]['goods_price'] != 0 ) {
      //   this.$message.error('请输入售卖价！')
      //   return
      // }
      // if (this.formFormatData.formData['sku'][0]['line_price'] == '' && this.formFormatData.formData['sku'][0]['line_price'] != 0) {
      //   this.$message.error('请输入市场价！')
      //   return
      // }
      if (this.formFormatData.formData['sku'][0]['stock_num'] == '' &&
      this.formFormatData.formData.is_settlement != 30 &&
      this.formFormatData.formData['sku'][0]['stock_num'] != 0 &&
      this.columnData.key == 'stock_num' == '') {
        this.$message.error('请输入商品库存！')
        return
      }
      if (this.formFormatData.formData.isexpress == 1 && this.formFormatData.formData.transport_type == 20 && this.formFormatData.formData.delivery_id == '') {
        this.$message.error('请选择运费模板！')
        return
      }

      console.log(this.formFormatData.formData, '===========++++++++++++++++++++++++++5555========')
      // delete this.formFormatData.formData.buss_id
      // this.id = this.formFormatData.formData.sku[0]['goodsid_fk'] 

        // return
      const data = Base64.encode(JSON.stringify(this.formFormatData.formData))

      this.$route.query.id ? goodsEdit : goodsAdd
      if (this.$route.query.id) {
        this.loading = true
        goodsEdit({ data }).then(res => {
          // this.loading = false
          const { data: { code, msg } } = res
          //保存成功后轮询处理富文本接口
            if(res.data.data.goods_id){
              this.AcquisitionProgress(res.data.data.goods_id)
            }
          // this.$message[code ? 'success' : 'error'](msg)
          // code && this.$router.push('/merchandise/merchandiseManagement')
        }).finally(()=>{
          this.loading = false
        })
      } else {
        this.loading = true
        goodsAdd({ data }).then(res => {
          // this.loading = false
          const { data: { code, msg } } = res
            if(res.data.data.goods_id){
              this.AcquisitionProgress(res.data.data.goods_id)
            }
        }).finally(()=>{
          this.loading = false
        })
      }

      console.log('最后最后最后最后最后最后最后最后最后最后最后最后最后',this.formFormatData.formData.sku)

      // this.formFormatSubmit({ router: { type: 'replace', path: '/merchandise/merchandiseManagement', code: 1 } })
    },
     AcquisitionProgress(goods_id) {
          this.syncMaterialLoding = true
              this.loading = true
              //轮询开始
          goodsRichTextHandle({goods_id:goods_id}).then(res => {
            //判断接口请求回来bool是否为false,是false就计算进度条数值
            // 1、请求完商品保存接口时，拿着保存接口返回的 goods_id 请求此接口
            // 2、进度条初始值的计算 初始化进度值为 0.00 ，然后用接口返回的已请求次数 / 总请求次数 * 100 保留两位小数计算出进度值（注意，大于等于 100 时直接赋值 100）
            // 3、判断 bool true表示已处理完成无需再轮询，false表示为处理完成还需继续请求
            // 4、提示保存成功
            if(res.data.data.bool==false){
               const newprogressNum = parseFloat((res.data.data.use_num / res.data.data.sum_num * 100).toFixed(2))
               this.progressNum = newprogressNum > 100 ? 100 : newprogressNum
                this.AcquisitionProgress(goods_id)
            }else{
                this.loading = false
                this.syncMaterialLoding = false
                this.$message.success("保存成功！")
                this.$router.push('/merchandise/merchandiseManagement')
                return false
            }
          })
    },

    chanageShopType(type) {
      console.log("9999sa++++fffff",type)
      this.resetField()
      // this.resetFormFormat()
      //  this.formFormatData.formData.by_know = this.defaultMsg2
      this.formFormatData.formData.goods_name = ''
      this.formFormatData.formData.transport_type = type
      this.formFormatData.formData.limit_time = ''
      this.formFormatData.formData.limit_day = ''
      // this.formFormatData.showNormal = true
      // this.formFormatData.showPrice = true
      // this.formFormatData.showOther = true
      // this.formFormatData.showSku = true
      // is_calendar_price   id_card  isexpress
      console.log("9999sa++++fffff",this.formFormatData.formData.transport_type)

      this.formFormatData.formData.transport_type == 40 && getSupplierList({ status: 1 }).then((response) => {
        const { data: { data: msgData = [] } } = response
        this.supplierData = msgData.data
      })
      this.formFormatData.formStep = 1
      this.formFormatData.formData.spec_type = 10
      this.$refs.trees.setCheckedKeys([])
      this.formFormatData.formData.category_id = []
      this.category_name = []

      this.$refs.multipleSpec.baseForm = {
        spec: [],
        specList: [],
        spectable: [],
        spectableCol: []
      }
      this.formFormatData.formData.is_settlement = 10
      if (type === 30) {
        this.getKamiList()
      }
      if(type==60){
        this.formFormatData.formData.is_calendar_price = 2
        this.formFormatData.formData.id_card = 2
        this.formFormatData.formData.isexpress = 0
        this.ticketGoodsAll()
      }

    },
    // categoDataGet(){
    //   this.ticketGoodsAll()
    // },
    ticketGoodsAll(){
      ticketGoodsAll({type:this.formFormatData.formData.ticketType}).then(res=>{
        console.log("+988888888888888888888888888888874",res.data.data)
        const { data: { code, msg } } = res
        this.categoryidData = res.data.data
        if(code==0){
          this.$message.error("请完善票务配置信息！")
        }
      })
    },
    getKamiList() {
      kammiSelected({ kammi_class: 1 }).then((response) => {
        const {
          data: {
            data: msgData = []
          }
        } = response
        this.cardData = msgData
        // this.$refs.multipleSpec.cardData = msgData
        console.log(' this.cardData+++++++++++++++', this.cardData)
      })
    },
    changeSpec(val) {
      console.log("ssssssssssssssss",this.formFormatData.formData.ticketType)
      this.formFormatData.formData.sku = [{
        goods_price: '',
        line_price: '',
        stock_num: '',
        stock_early: '',
        goods_no: '',
        goods_weight: '',
        goodsid_fk:'',
        limit_buy:10,
        limit_num:'',
        code_num:'1'
      }]
    
      this.formFormatData.formData.skuData = {}
      if (val === 20) {
        this.multipleSpecChange()
      }
      //票务商品切换多规格时弹窗提示
      if(val ==20 && this.formFormatData.formData.transport_type==60){
            this.formFormatData.formData.is_meal = 1
              this.$confirm('切换多规格时，请在列表中选择票务种类！', '提示', {
              confirmButtonText: '确定',
              cancelButtonText: '取消',
              type: 'warning'
            }).then(() => {

            }).catch(() => {
                this.$message({
                  type: 'info',
                  message: '已取消！'
                });        
            })
      }else{  
        this.formFormatData.formData.is_meal = 2
      }
      if((this.formFormatData.formData.transport_type==10 || this.formFormatData.formData.transport_type==20) && this.formFormatData.formData.spec_type==20 ){
        this.formFormatData.formData.is_step_price =2
      }
      //多买赠礼相关操作
      if(val==20&&this.formFormatData.formData.is_buy_and_give==1){
        this.formFormatData.formData.is_buy_and_give=2
          this.formFormatData.formData.buy_and_give_rules=[{purchase:'',give:''}]
        this.formFormatData.formData.is_calculate_sales=2
        this.formFormatData.formData.give_settlement_rules={status: '1',money: ''}
      }
    }
  }
}
</script>

<style lang="scss" scoped>
$is-success: #67c23a;
$update: 50px;

.merchandise-management-add {

  .inputNumber {
    /deep/ .el-input {
      width: 80px;
    }
  }

  .poster {
    /deep/ .el-input,
    .el-input-number {
      width: 200px;
    }
  }

  /deep/ .wlm-form-steps {
    white-space: nowrap;
    background: #f7f7f7;
    padding-bottom: 20px;

    .goods-step {
      > span {
        position: relative;
        display: inline-block;
        cursor: pointer;
        background: #fff;
        height: 40px;
        line-height: 40px;
        text-align: center;
        font-size: 14px;
        box-sizing: border-box;
        width: 515px;
        margin-left: -30px;
        z-index: 0;
        border-radius: 40px;

        &.active {
          position: relative;
          z-index: 1;
          color: #fff;
          background: #409eff;
        }
      }
    }
  }
  .inputBtn{
    /deep/ .el-tag--light {
      overflow: hidden;
      text-overflow: ellipsis;
    }

  }
  .category-tree {
    width: 270px;
    margin-top: 20px;
  }

  .send-type {
    margin-top: 15px;
    padding: 0 20px;
    margin-bottom: 20px;

    .el-button {
      position: relative;
      overflow: hidden;
      padding: 15px 40px;

      & > span {
        & > p {
          font-weight: 600;
          margin-bottom: 15px;
        }

        & > span {
          display: inline-block;
          margin-bottom: 5px;
          color: #c3c3c3;
        }
      }

      .triangle {
        display: none;
        color: #fff;
      }

      &.is-active {
        & > span {
          // &>span {
          //     color: #387abd;
          // }
        }

        .triangle {
          display: inline-block;
          position: absolute;
          right: 0;
          line-height: 60px;
          text-align: center;
          background: #409eff !important;
          transform: rotate(45deg);
          -webkit-transform: rotate(45deg);
          -moz-transform: rotate(45deg);
          -ms-transform: rotate(45deg);

          > i {
            transform: rotate(-45deg);
            -webkit-transform: rotate(-45deg);
            -moz-transform: rotate(-45deg);
            -ms-transform: rotate(-45deg);
          }
        }
      }
    }
  }
  .update-load {
    display: inline-block;
    cursor: pointer;
    width: $update;
    height: $update;
    background: #fafbff;
    border: 1px dashed #c0ccda;
    color: #a8abb0;
    border-radius: 5px;

    i {
      font-size: 14px;
      color: #8c939d;
      width: $update;
      height: $update;
      line-height: $update;
      text-align: center;
    }
    .el-select-dropdown{
      max-width: 243px;
    }
    .el-select-dropdown__item{
      display:inline-block;
    }
    .el-select-dropdown__item span{
      min-width: 205px;
      display: inline-block;
    }
  }
  .append-right{
    border-right-color: #dcdfe6;

  }
  .temap{
    /deep/.el-input__inner{
      width: 100px;
    }
  }
}
</style>
